projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5377286
)
udhcp: make arpping code resistant to time jumps
author
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 17 Apr 2012 15:10:31 +0000
(17:10 +0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 17 Apr 2012 15:10:31 +0000
(17:10 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/udhcp/arpping.c
patch
|
blob
|
history
diff --git
a/networking/udhcp/arpping.c
b/networking/udhcp/arpping.c
index ff6347847f528b3f0008666786b7740e6424c6f5..b43e52e964e0b48c3031b41e9c820b9da2d21969 100644
(file)
--- a/
networking/udhcp/arpping.c
+++ b/
networking/udhcp/arpping.c
@@
-118,8
+118,13
@@
int FAST_FUNC arpping(uint32_t test_nip,
break;
}
}
- timeout_ms -= (unsigned)monotonic_ms() - prevTime;
- } while (timeout_ms > 0);
+ timeout_ms -= (unsigned)monotonic_ms() - prevTime + 1;
+
+ /* We used to check "timeout_ms > 0", but
+ * this is more under/overflow-resistant
+ * (people did see overflows here when system time jumps):
+ */
+ } while ((unsigned)timeout_ms <= 2000);
ret:
close(s);