abis_nm: Fix possible not-null-terminated buffer

Unrealistic case with file name of 4096 bytes length.

Change-Id: I503200b879b854cf2dc218d5fe3059a555732d92
Fixes: Coverity CID 57619
This commit is contained in:
Harald Welte 2016-11-25 23:52:46 +01:00
parent 28f637ec2c
commit 7b6bae6584
1 changed files with 1 additions and 0 deletions

View File

@ -2305,6 +2305,7 @@ int abis_nm_bs11_load_swl(struct gsm_bts *bts, const char *fname,
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;