mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 20:14:12 +08:00
Use EXTRACT_U_1().
This commit is contained in:
parent
dcf5ee83bb
commit
1fc4376091
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user