[MERGED] openbsc[master]: abis_nm: Fix possible not-null-terminated buffer

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 16:08:38 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: abis_nm: Fix possible not-null-terminated buffer
......................................................................


abis_nm: Fix possible not-null-terminated buffer

Unrealistic case with file name of 4096 bytes length.

Change-Id: I503200b879b854cf2dc218d5fe3059a555732d92
Fixes: Coverity CID 57619
---
M openbsc/src/libbsc/abis_nm.c
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 3289b3c..fb6a957 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2305,6 +2305,7 @@
 	bs11_sw->forced = forced;
 
 	strncpy(bs11_sw->swl_fname, fname, sizeof(bs11_sw->swl_fname));
+	bs11_sw->swl_fname[sizeof(bs11_sw->swl_fname)-1] = '\0';
 	rc = bs11_read_swl_file(bs11_sw);
 	if (rc < 0)
 		return rc;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I503200b879b854cf2dc218d5fe3059a555732d92
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list