]> The Tcpdump Group git mirrors - tcpdump/commitdiff
SMB: Avoid an unsigned integer underflow
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 8 Mar 2019 12:23:34 +0000 (13:23 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sat, 9 Mar 2019 20:20:04 +0000 (21:20 +0100)
print-smb.c

index caf05b2a07534410e79531f08721b25194e10cfd..6592c5eb531af6b0684c7719fb77336243dfd307 100644 (file)
@@ -1199,7 +1199,7 @@ nbt_udp137_print(netdissect_options *ndo,
                    p = smb_fdata(ndo, p, "NumNames=[B]\n", p + 1, 0);
                    if (p == NULL)
                        goto out;
-                   while (numnames--) {
+                   while (numnames) {
                        p = smb_fdata(ndo, p, "Name=[n2]\t#", maxbuf, 0);
                        if (p == NULL)
                            goto out;
@@ -1224,6 +1224,7 @@ nbt_udp137_print(netdissect_options *ndo,
                            ND_PRINT("<PERMANENT> ");
                        ND_PRINT("\n");
                        p += 2;
+                       numnames--;
                    }
                } else {
                    if (p >= maxbuf)