[PATCH] openbsc[master]: abis_nm: Fix non-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 13:44:36 UTC 2016


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

abis_nm: Fix non-null terminated buffer

Unrealistic case (filename of 4096 bytes)

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


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/09/1309/1

diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index fb6a957..c9b2aac 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2234,6 +2234,7 @@
 
 		/* construct new filename */
 		strncpy(dir, bs11_sw->swl_fname, sizeof(dir));
+		dir[sizeof(dir)-1] = '\0';
 		strncat(fle->fname, dirname(dir), sizeof(fle->fname) - 1);
 		strcat(fle->fname, "/");
 		strncat(fle->fname, file_id, sizeof(fle->fname) - 1 -strlen(fle->fname));

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf7b835f9edaf66976556fce1e9e0f66aa2010bc
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