aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-11-25 23:54:18 +0100
committerHarald Welte <laforge@gnumonks.org>2016-11-26 16:08:38 +0000
commitb0993e61d002b265048c3dc734c4fa89e0b1995f (patch)
tree0842c009c87b25ffab365e50aa6cbf68481e2d43
parent7b6bae65847e5ff6b695054fddca3080fc9d3d99 (diff)
abis_nm: Fix non-null terminated buffer
Unrealistic case (filename of 4096 bytes) Change-Id: Icf7b835f9edaf66976556fce1e9e0f66aa2010bc Fixes: Coverity CID 57620
-rw-r--r--openbsc/src/libbsc/abis_nm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index fb6a9572..c9b2aaca 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -2234,6 +2234,7 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
/* 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));