fix unsigned arithmetic bug in previous change
This commit is contained in:
parent
38ae88d332
commit
2c4e3a8061
@ -1,3 +1,8 @@
|
||||
2002-05-24 John Hughes <john@calva.com>
|
||||
|
||||
* stream.h, net.h: Avoid possible infinite loop caused by
|
||||
unsigned arithmetic in preceeding change.
|
||||
|
||||
2002-05-23 John Hughes <john@calva.com>
|
||||
|
||||
* acconfig.h: Add HAVE_OPTHDR and HAVE_T_OPTHDR defines.
|
||||
|
8
net.c
8
net.c
@ -1436,7 +1436,7 @@ int len;
|
||||
int c = 0;
|
||||
struct opthdr hdr;
|
||||
|
||||
while (len >= sizeof hdr) {
|
||||
while (len >= (int) sizeof hdr) {
|
||||
if (umove(tcp, addr, &hdr) < 0) break;
|
||||
if (c++) {
|
||||
tprintf (", ");
|
||||
@ -1448,8 +1448,10 @@ int len;
|
||||
addr += sizeof hdr;
|
||||
len -= sizeof hdr;
|
||||
printsockopt (tcp, hdr.level, hdr.name, addr, hdr.len);
|
||||
addr += hdr.len;
|
||||
len -= hdr.len;
|
||||
if (hdr.len > 0) {
|
||||
addr += hdr.len;
|
||||
len -= hdr.len;
|
||||
}
|
||||
tprintf ("}");
|
||||
}
|
||||
if (len > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user