[B.A.T.M.A.N.] [PATCH 05/10] batadv-vis: Avoid invalid access in orig_list

Sven Eckelmann
2014-05-24T11:44:10Z

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@narfation.org>

---
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)
--
2.0.0.rc2