diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2021-03-29 15:49:58 +0100 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2021-03-29 16:01:05 +0100 |
commit | 4fe72511c308b9b6a2cc094f88b40b2d0b8d8bab (patch) | |
tree | c8762de6b995561990da8463f9946761de2c6473 | |
parent | 244754b3f0d3e733dc5b7dba8dcba33a3e107afe (diff) | |
download | tcpdump-4fe72511c308b9b6a2cc094f88b40b2d0b8d8bab.tar.gz |
ForCES: Refine SPARSEDATA-TLV length check.
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.
-rw-r--r-- | print-forces.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/print-forces.c b/print-forces.c index 31cd2df4..adb25fbb 100644 --- a/print-forces.c +++ b/print-forces.c @@ -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) { |