Repositories
/
olsrd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0ec6a11
)
ipcalc: protect prefix_to_netmask against invalid input
author
Ferry Huberts
<ferry.huberts@pelagic.nl>
Fri, 6 Nov 2015 09:25:25 +0000
(10:25 +0100)
committer
Ferry Huberts
<ferry.huberts@pelagic.nl>
Thu, 2 Jun 2016 20:06:47 +0000
(22:06 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/ipcalc.c
patch
|
blob
|
history
diff --git
a/src/ipcalc.c
b/src/ipcalc.c
index
737c4c0
..
06df598
100644
(file)
--- a/
src/ipcalc.c
+++ b/
src/ipcalc.c
@@
-89,6
+89,10
@@
prefix_to_netmask(uint8_t * a, int len, uint8_t prefixlen)
int p;
const uint8_t *a_end;
+ if (len <= 0 || !a) {
+ return 0;
+ }
+
a_end = a + len;
for (p = prefixlen; a < a_end && p > 8; p -= 8) {
*a++ = 0xff;