]> The Tcpdump Group git mirrors - tcpdump/commitdiff
ForCES: Refine SPARSEDATA-TLV length check.
authorDenis Ovsienko <[email protected]>
Mon, 29 Mar 2021 14:49:58 +0000 (15:49 +0100)
committerDenis Ovsienko <[email protected]>
Mon, 29 Mar 2021 15:01:05 +0000 (16:01 +0100)
When ilv_valid() returns a non-zero in sdatailv_print(), the amount of
bytes declared remaining may be insufficient to contain a complete
header, let alone any data. Thus do not try to hex dump the data,
instead print an error message and be done with it.

This fixes an inconsistency discovered by Francois-Xavier.

print-forces.c

index 31cd2df483a241f639e5859cfa6b6a997226250e..adb25fbb3bb7a5250eb00931add83479225046b1 100644 (file)
@@ -748,9 +748,8 @@ sdatailv_print(netdissect_options *ndo,
                const u_char *tdp = (const u_char *) ILV_DATA(ilv);
                invilv = ilv_valid(ndo, ilv, rlen);
                if (invilv) {
-                       ND_PRINT("%s[", ib + 1);
-                       hex_print(ndo, ib, tdp, rlen);
-                       ND_PRINT("\n%s]\n", ib + 1);
+                       ND_PRINT("Error: %s, rlen %u\n",
+                                tok2str(ForCES_TLV_err, NULL, invilv), rlen);
                        goto invalid;
                }
                if (ndo->ndo_vflag >= 3) {