summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-04 20:34:46 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-04 20:34:46 +0200
commit9feef48eaf2ae79f724cedb137866d0f3f9741bf (patch)
treea441be7415f456b4d09fdb81406cc493bbd433ff
parente885951f27cd3ab5e4726b65105114875c5d808c (diff)
nitb: Add a missing NULL check for searching the subscriber
"subscriber " SUBSCR_TYPES " ID sms pending-send could fail with an invalid ID/IMSI for the subscriber. Fixes: Coverity CID 1040715
-rw-r--r--openbsc/src/libmsc/vty_interface_layer3.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c
index 8dc2812..6b83275 100644
--- a/openbsc/src/libmsc/vty_interface_layer3.c
+++ b/openbsc/src/libmsc/vty_interface_layer3.c
@@ -216,9 +216,16 @@ DEFUN(subscriber_send_pending_sms,
SUBSCR_HELP "SMS Operations\n" "Send pending SMS\n")
{
struct gsm_network *gsmnet = gsmnet_from_vty(vty);
- struct gsm_subscriber *subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]);
+ struct gsm_subscriber *subscr;
struct gsm_sms *sms;
+ subscr = get_subscr_by_argv(gsmnet, argv[0], argv[1]);
+ if (!subscr) {
+ vty_out(vty, "%% No subscriber found for %s %s%s",
+ argv[0], argv[1], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
sms = db_sms_get_unsent_by_subscr(gsmnet, subscr->id, UINT_MAX);
if (sms)
gsm411_send_sms_subscr(sms->receiver, sms);