mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-24 02:23:27 +08:00
In print_data(), check each byte to make sure we haven't gone past the
end of the captured packet data.
This commit is contained in:
parent
44e351db08
commit
229cf9681b
@ -12,7 +12,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.38 2007-06-15 19:49:41 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.39 2007-07-15 19:07:39 guy Exp $";
|
||||
#endif
|
||||
|
||||
#include <tcpdump-stdinc.h>
|
||||
@ -279,6 +279,7 @@ print_data(const unsigned char *buf, int len)
|
||||
return;
|
||||
printf("[%03X] ", i);
|
||||
for (i = 0; i < len; /*nothing*/) {
|
||||
TCHECK(buf[i]);
|
||||
printf("%02X ", buf[i] & 0xff);
|
||||
i++;
|
||||
if (i%8 == 0)
|
||||
@ -310,6 +311,11 @@ print_data(const unsigned char *buf, int len)
|
||||
print_asc(&buf[i - n], n);
|
||||
printf("\n");
|
||||
}
|
||||
return;
|
||||
|
||||
trunc:
|
||||
printf("\n");
|
||||
printf("WARNING: Short packet. Try increasing the snap length\n");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user