]> The Tcpdump Group git mirrors - tcpdump/commitdiff
SUNRPC: Add a bounds check
authorFrancois-Xavier Le Bail <[email protected]>
Sat, 2 Jun 2018 21:38:18 +0000 (23:38 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 2 Jun 2018 21:38:18 +0000 (23:38 +0200)
print-sunrpc.c

index d5ffe8d46d369473c349cd38ac13d08cbd162f45..f83f4eb92d31935272ace99ec0fb699a37676401 100644 (file)
@@ -169,6 +169,7 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp,
 
        ndo->ndo_protocol = "sunrpc";
        rp = (const struct sunrpc_msg *)bp;
+       ND_TCHECK_SIZE(rp);
 
        if (!ndo->ndo_nflag) {
                nd_snprintf(srcid, sizeof(srcid), "0x%x",
@@ -218,6 +219,10 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp,
                ND_PRINT(".%u", EXTRACT_BE_U_4(rp->rm_call.cb_vers));
                break;
        }
+       return;
+
+trunc:
+       nd_print_trunc(ndo);
 }
 
 static char *