From 4988628a2e41955951a49ea0032cabe13f9337d3 Mon Sep 17 00:00:00 2001 From: Christof Hanke Date: Mon, 18 Dec 2017 16:58:39 +0100 Subject: [PATCH] Avoid gcc warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/vol/vutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.39.5