]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use EXTRACT_U_1().
authorGuy Harris <[email protected]>
Thu, 23 Nov 2017 21:07:13 +0000 (13:07 -0800)
committerGuy Harris <[email protected]>
Thu, 23 Nov 2017 21:07:13 +0000 (13:07 -0800)
print-atalk.c

index 2f6242cfcb65f703b5deb39f00fe37e124e198fe..ce61a44c9de18802a83d62b5b40c39b0ed274e36 100644 (file)
@@ -480,19 +480,22 @@ print_cstring(netdissect_options *ndo,
                ND_PRINT((ndo, "%s", tstr));
                return (0);
        }
-       length = *cp++;
+       length = EXTRACT_U_1(cp);
+       cp++;
 
        /* Spec says string can be at most 32 bytes long */
        if (length > 32) {
                ND_PRINT((ndo, "[len=%u]", length));
                return (0);
        }
-       while ((int)--length >= 0) {
+       while (length != 0) {
                if (cp >= (const char *)ep) {
                        ND_PRINT((ndo, "%s", tstr));
                        return (0);
                }
-               ND_PRINT((ndo, "%c", *cp++));
+               ND_PRINT((ndo, "%c", EXTRACT_U_1(cp)));
+               cp++;
+               length--;
        }
        return (cp);
 }