libselinux: avcstat: fix build warning

Fix the following build warning.

avcstat.c: In function ‘main’:
avcstat.c:113:4: error: ‘strncpy’ specified bound 4096 equals destination size [-Werror=stringop-truncation]
    strncpy(avcstatfile, optarg, sizeof avcstatfile);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
Stephen Smalley 2018-05-03 14:48:44 -04:00 committed by stephensmalley
parent 8467979d41
commit e76569f863

View File

@ -110,7 +110,8 @@ int main(int argc, char **argv)
cumulative = 1;
break;
case 'f':
strncpy(avcstatfile, optarg, sizeof avcstatfile);
strncpy(avcstatfile, optarg, sizeof(avcstatfile) - 1);
avcstatfile[sizeof(avcstatfile)-1] = '\0';
break;
case 'h':
case '-':