aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-05 12:34:44 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-12-06 12:51:17 +0000
commitf6704f1a50fa7ab74c02f90ad8c81c3f21d7c986 (patch)
treea818f39e6ee72294b6214024da96c3b2bfb17010
parenta55dda703fc5e367bd58b5f9f6986d62ffbbdb6c (diff)
sms db: don't attempt to query pending SMS for unset MSISDN
When the subscriber has no MSISDN, we might construct an invalid SQL statement such as ... AND dest_addr= AND ... Instead, don't even query for empty MSISDNs. Related: OS#2706 Change-Id: I7d6169d774b2da04b3051957e364fe620feed51e
-rw-r--r--src/libmsc/db.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index 4e4477b6e..ca27b6a22 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -840,6 +840,10 @@ struct gsm_sms *db_sms_get_unsent_for_subscr(struct vlr_subscr *vsub,
if (!vsub->lu_complete)
return NULL;
+ /* A subscriber having no phone number cannot possibly receive SMS. */
+ if (*vsub->msisdn == '\0')
+ return NULL;
+
result = dbi_conn_queryf(conn,
"SELECT * FROM SMS"
" WHERE sent IS NULL"