From: Christof Hanke Date: Mon, 18 Dec 2017 15:58:39 +0000 (+0100) Subject: Avoid gcc warning X-Git-Tag: upstream/1.8.0_pre5^2~9 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4988628a2e41955951a49ea0032cabe13f9337d3;p=packages%2Fo%2Fopenafs.git Avoid gcc warning When using the configure option --enable-checking with gcc 7.2.1, the compilation fails with vutil.c:860:20: error: ā€˜%s’ directive writing up to 255 bytes into \ a region of size 63 [-Werror=format-overflow=] This can be seen in the logs of the openSUSE Tumbleweed builder for e.g. build 2368. Avoid this warning by using snprintf which is provided by libroken for all platforms. Reviewed-on: https://gerrit.openafs.org/12813 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit fd4eaebb60dbefc27be98015fee23a3cf5d9752d) Change-Id: I3be14f6f1228fd09f036da7ff4f1505c65e49406 Reviewed-on: https://gerrit.openafs.org/12897 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/vol/vutil.c b/src/vol/vutil.c index c7c7a8d7f..cafed4de6 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -857,7 +857,7 @@ VWalkVolumeHeaders(struct DiskPartition64 *dp, const char *partpath, if (p != NULL && strcmp(p, VHDREXT) == 0) { char name[VMAXPATHLEN]; - sprintf(name, "%s" OS_DIRSEP "%s", partpath, dentry->d_name); + snprintf(name, VMAXPATHLEN, "%s" OS_DIRSEP "%s", partpath, dentry->d_name); code = _VHandleVolumeHeader(dp, volfunc, name, &diskHeader, -1, rock); if (code < 0) {