Review at  https://gerrit.osmocom.org/7123

libbsc/bsc_vty.c: prevent uninitialized access

If an out of range 'Last Valid Block' value for 'smscb-command'
is passed, a 'last_block' of the 'rsl_ie_cb_cmd_type' struct
could be uninitialized. Let's prevent this.

Found using Clang Static Analyzer.

Change-Id: I57635f2f482ff476ab697b1b9e872ce90aafb999
---
M src/libbsc/bsc_vty.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/23/7123/1

diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 3dac29e..47bc514 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -4258,6 +4258,9 @@
        case 4:
                cb_cmd.last_block = RSL_CB_CMD_LASTBLOCK_4;
                break;
+       default:
+               vty_out(vty, "Error parsing LASTBLOCK%s", VTY_NEWLINE);
+               return CMD_WARNING;
        }
 
        rsl_sms_cb_command(bts, RSL_CHAN_SDCCH4_ACCH, cb_cmd, buf, rc);

-- 
To view, visit https://gerrit.osmocom.org/7123
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I57635f2f482ff476ab697b1b9e872ce90aafb999
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com>

Reply via email to