diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-07-16 13:16:39 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-07-16 13:16:39 +0200 |
commit | 46324ccfcd59bbbc594355637ea44f048ef04c8d (patch) | |
tree | f434e834c27b90cf4364453a2eec7b28d640358d | |
parent | 142c4b8ca8678a72bf5729974be7a86e35e24f6b (diff) |
bsc_vty: Fix some Smatch warnings
/home/laforge/projects/git/openbsc/openbsc/src/libbsc/bsc_vty.c +1062
show_e1ts(25) warn: variable dereferenced before check 'line'
/home/laforge/projects/git/openbsc/openbsc/src/libbsc/bsc_vty.c +1075
show_e1ts(38) warn: buffer overflow 'line->ts' 32 <= 32
-rw-r--r-- | openbsc/src/libbsc/bsc_vty.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 971cdf703..a2906932f 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -1055,11 +1055,14 @@ DEFUN(show_e1ts, } if (argc >= 1) { int num = atoi(argv[0]); - llist_for_each_entry(line, &e1inp_line_list, list) { - if (line->num == num) + struct e1inp_line *l; + llist_for_each_entry(l, &e1inp_line_list, list) { + if (l->num == num) { + line = l; break; + } } - if (!line || line->num != num) { + if (!line) { vty_out(vty, "E1 line %s is invalid%s", argv[0], VTY_NEWLINE); return CMD_WARNING; @@ -1067,7 +1070,7 @@ DEFUN(show_e1ts, } if (argc >= 2) { ts_nr = atoi(argv[1]); - if (ts_nr > NUM_E1_TS) { + if (ts_nr >= NUM_E1_TS) { vty_out(vty, "E1 timeslot %s is invalid%s", argv[1], VTY_NEWLINE); return CMD_WARNING; |