]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix test for truncated sname and file.
authorGuy Harris <[email protected]>
Thu, 21 Jun 2018 21:54:02 +0000 (14:54 -0700)
committerGuy Harris <[email protected]>
Thu, 21 Jun 2018 21:54:02 +0000 (14:54 -0700)
nd_printztn() returns 0 if the string is truncated; check for it
returning zero, not for returning a non-zero value.

This fix was supplied in GitHub issue #685.

print-bootp.c

index 8d2166c28dc53a520913373ad10a592e0937787f..62b337cb411837251d07b90e702154c9f8f5cfa3 100644 (file)
@@ -361,7 +361,7 @@ bootp_print(netdissect_options *ndo,
        if (EXTRACT_U_1(bp->bp_sname)) {
                ND_PRINT("\n\t  sname \"");
                if (nd_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname),
-                               ndo->ndo_snapend)) {
+                               ndo->ndo_snapend) == 0) {
                        ND_PRINT("\"");
                        nd_print_trunc(ndo);
                        return;
@@ -372,7 +372,7 @@ bootp_print(netdissect_options *ndo,
        if (EXTRACT_U_1(bp->bp_file)) {
                ND_PRINT("\n\t  file \"");
                if (nd_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file),
-                               ndo->ndo_snapend)) {
+                               ndo->ndo_snapend) == 0) {
                        ND_PRINT("\"");
                        nd_print_trunc(ndo);
                        return;