[MERGED] osmo-bsc[master]: libbsc/bsc_vty.c: prevent uninitialized access

2018-03-06 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: libbsc/bsc_vty.c: prevent uninitialized access
..


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I57635f2f482ff476ab697b1b9e872ce90aafb999
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bsc[master]: libbsc/bsc_vty.c: prevent uninitialized access

2018-03-06 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I57635f2f482ff476ab697b1b9e872ce90aafb999
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: libbsc/bsc_vty.c: prevent uninitialized access

2018-03-06 Thread Vadim Yanitskiy

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