From fd4eaebb60dbefc27be98015fee23a3cf5d9752d 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. Change-Id: I6acd3a1c06760abc8144c0892812c3bb50477227 Reviewed-on: https://gerrit.openafs.org/12813 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- 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 c7c7a8d..cafed4d 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) { -- 1.9.4