summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-06-01 14:42:09 -0700
committerGuy Harris <guy@alum.mit.edu>2019-06-01 14:42:09 -0700
commit511915bef7e4de2f31b8d9f581b4a44b0cfbcf53 (patch)
tree5e56d6babc04c8560b9514299a2c1cccb8e688c3
parentcfc663988081e9ed293d46de626b1f98e91b2de5 (diff)
downloadtcpdump-511915bef7e4de2f31b8d9f581b4a44b0cfbcf53.tar.gz
If decode_prefix6() returns a negative number, don't print buf.
If it returns a negative number, it hasn't necessarily filled in buf, so just return immediately; this is similar to the IPv4 code path, wherein we just return a negative number, and print nothing, on an error. This should fix GitHub issue #763.
-rw-r--r--print-hncp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/print-hncp.c b/print-hncp.c
index 8be59e37..3a3c01ea 100644
--- a/print-hncp.c
+++ b/print-hncp.c
@@ -231,6 +231,8 @@ print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length)
plenbytes += 1 + IPV4_MAPPED_HEADING_LEN;
} else {
plenbytes = decode_prefix6(ndo, prefix, max_length, buf, sizeof(buf));
+ if (plenbytes < 0)
+ return plenbytes;
}
ND_PRINT("%s", buf);