[PATCH] openbsc[master]: libmsc/db: Prevent subscr->extension without NULL termination

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Nov 26 13:44:36 UTC 2016


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

libmsc/db: Prevent subscr->extension without NULL termination

Change-Id: Ic1ae7b2d9dde8dab8f7795e5baa8918424f5f393
Fixes: Coverity CID 57622
---
M openbsc/src/libmsc/db.c
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/11/1311/1

diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 5cccb32..c212fcd 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -837,8 +837,10 @@
 	}
 
 	string = dbi_result_get_string(result, "extension");
-	if (string)
+	if (string) {
 		strncpy(subscr->extension, string, GSM_EXTENSION_LENGTH);
+		subscr->extension[sizeof(subscr->extension)-1] = '\0';
+	}
 
 	subscr->lac = dbi_result_get_ulonglong(result, "lac");
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1ae7b2d9dde8dab8f7795e5baa8918424f5f393
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list