Enviorment:
Fedora release 28 (Twenty Eight)
gcc (GCC) 8.0.1
20180324 (Red Hat 8.0.1-0.20)
Copyright (C) 2018 Free Software Foundation, Inc.
Hit build failure:
lfs_project.c: In function ‘lfs_project_item_alloc’:
lfs_project.c:72:2: error: ‘strncpy’ specified bound 4096
equals destination size [-Werror=stringop-truncation]
strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test-Parameters: trivial testlist=sanity-quota
Change-Id: Ia6429c47391bf503546609ec6a262fe24664bdd4
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/35257
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
- strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname));
+ strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname) - 1);
list_add_tail(&lpi->lpi_list, head);
return 0;
list_add_tail(&lpi->lpi_list, head);
return 0;