summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-25 23:57:01 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 16:08:38 +0000
commit96df07708371313348d063032ee341592c27defc (patch)
tree416a6cacecc6b630199310ef51b13e2a2ff143d9
parentb0993e61d002b265048c3dc734c4fa89e0b1995f (diff)
libmsc/db: avoid subscr->name without terminating NULL char
Change-Id: Ic8944ac4c5e940c9d835c52f1701461f274238db Fixes: Coverity CID 57621
-rw-r--r--openbsc/src/libmsc/db.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 68eba3e17..5cccb3280 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -831,8 +831,10 @@ static void db_set_from_query(struct gsm_subscriber *subscr, dbi_conn result)
subscr->tmsi = tmsi_from_string(string);
string = dbi_result_get_string(result, "name");
- if (string)
+ if (string) {
strncpy(subscr->name, string, GSM_NAME_LENGTH);
+ subscr->name[sizeof(subscr->name)-1] = '\0';
+ }
string = dbi_result_get_string(result, "extension");
if (string)