abis_nm: Fix non-null terminated buffer

Unrealistic case (filename of 4096 bytes)

Change-Id: Icf7b835f9edaf66976556fce1e9e0f66aa2010bc
Fixes: Coverity CID 57620
This commit is contained in:
Harald Welte 2016-11-25 23:54:18 +01:00
parent 7b6bae6584
commit b0993e61d0
1 changed files with 1 additions and 0 deletions

View File

@ -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));