summaryrefslogtreecommitdiff
path: root/print-telnet.c
diff options
context:
space:
mode:
authorguy <guy>2002-09-05 00:00:07 +0000
committerguy <guy>2002-09-05 00:00:07 +0000
commitedb0e92cdcaf06168a38e632847b8fd2c0a62a2d (patch)
treefaf57bac69529b8d0e0700df10e30844cf553779 /print-telnet.c
parent28b539271c4d4ac30faa29cdb79d040c823535ab (diff)
downloadtcpdump-edb0e92cdcaf06168a38e632847b8fd2c0a62a2d.tar.gz
Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings: addrtoname.c, configure.in: Linux needs netinet/ether.h for ether_ntohost print-*.c: change char *foo = "bar" to const char *foo = "bar" to appease -Wwrite-strings; should affect no run-time behavior. print-*.c: make some variables unsigned. print-bgp.c: plen ('prefix len') is unsigned, no reason to validate by comparing to zero. print-cnfp.c, print-rx.c: use intoa, provided by addrtoname, instead of inet_ntoa. print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to be false, so check for (u_int)-1, which represents failure, explicitly. print-isakmp.c: complete initialization of attrmap objects. print-lwres.c: "if(x); print foo;" seemed much more likely to be intended to be "if(x) { print foo; }". print-smb.c: complete initialization of some structures. In addition, add some fixes for the signed vs. unsigned comparison warnings: extract.h: cast the result of the byte-extraction-and-combining, as, at least for the 16-bit version, C's integral promotions will turn "u_int16_t" into "int" if there are other "int"s nearby. print-*.c: make some more variables unsigned, or add casts to an unsigned type of signed values known not to be negative, or add casts to "int" of unsigned values known to fit in an "int", and make other changes needed to handle the aforementioned variables now being unsigned. print-isakmp.c: clean up the handling of error/status indicators in notify messages. print-ppp.c: get rid of a check that an unsigned quantity is >= 0. print-radius.c: clean up some of the bounds checking. print-smb.c: extract the word count into a "u_int" to avoid the aforementioned problems with C's integral promotions. print-snmp.c: change a check that an unsigned variable is >= 0 to a check that it's != 0. Also, fix some formats to use "%u" rather than "%d" for unsigned quantities.
Diffstat (limited to 'print-telnet.c')
-rw-r--r--print-telnet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/print-telnet.c b/print-telnet.c
index 35998fcf..b3d99cb5 100644
--- a/print-telnet.c
+++ b/print-telnet.c
@@ -51,7 +51,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.20 2002-08-01 08:53:32 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-telnet.c,v 1.21 2002-09-05 00:00:22 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -109,7 +109,8 @@ numstr(int x)
static int
telnet_parse(const u_char *sp, u_int length, int print)
{
- int i, c, x;
+ int i, x;
+ u_int c;
const u_char *osp, *p;
#define FETCH(c, sp, length) \
do { \
@@ -155,7 +156,7 @@ telnet_parse(const u_char *sp, u_int length, int print)
break;
/* IAC SB .... IAC SE */
p = sp;
- while (length > p + 1 - sp) {
+ while (length > (u_int)(p + 1 - sp)) {
if (p[0] == IAC && p[1] == SE)
break;
p++;