Repository : ssh://git@open-mesh.org/alfred
On branch : master
---------------------------------------------------------------
commit 807ce0f505ea1057dd83234106d288fe8d60d9a4
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Sat May 24 13:44:10 2014 +0200
batadv-vis: Avoid invalid access in orig_list
The orig list parsing tries to gather information from 4 columns for each line.
The second part of the parsing routine should only be started when all
columns could be found. Otherwise parts of the variables are uninitialized.
Dereferencing iface in such a situation can cause a segfault.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
Signed-off-by: Simon Wunderlich <sw(a)simonwunderlich.de>
---------------------------------------------------------------
807ce0f505ea1057dd83234106d288fe8d60d9a4
vis/vis.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vis/vis.c b/vis/vis.c
index 31f60d7..2928d65 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -350,7 +350,7 @@ static int parse_orig_list(struct globals *globals)
default: break;
}
}
- if (tnum >= 4) {
+ if (tnum > 4) {
if (strcmp(dest, neigh) == 0) {
tq_val = strtol(tq, NULL, 10);
if (tq_val < 1 || tq_val > 255)