From: Andrew Deason Date: Tue, 7 Aug 2018 22:27:24 +0000 (-0500) Subject: Avoid format truncation warnings X-Git-Tag: upstream/1.8.3^2~6 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=232bd12b070e1fbeb173e31251e65e63a0d1f959;p=packages%2Fo%2Fopenafs.git Avoid format truncation warnings With gcc 7.3, we start getting several warnings like the following: vutil.c: In function ‘VWalkVolumeHeaders’: vutil.c:860:34: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 63 [-Werror=format-truncation=] snprintf(name, VMAXPATHLEN, "%s" OS_DIRSEP "%s", partpath, dentry->d_name); Most or all of these truncations should be okay, but increase the size of the relevant buffers so we can build with warning checking turned on. Reviewed-on: https://gerrit.openafs.org/13274 Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot (cherry picked from commit 2daa413e3ec061e0653adbd1d6549f15e0659a62) Change-Id: I61ae1ddae4b2d84147198a1dccb280d0da100a0b Reviewed-on: https://gerrit.openafs.org/13459 Tested-by: BuildBot Reviewed-by: Stephan Wiesand --- diff --git a/src/aklog/klog.c b/src/aklog/klog.c index 88e49070a..9677ffad8 100644 --- a/src/aklog/klog.c +++ b/src/aklog/klog.c @@ -214,7 +214,7 @@ whoami(struct ktc_token *atoken, int *vicep) { int code; - char tempname[PR_MAXNAMELEN + 1]; + char tempname[2*PR_MAXNAMELEN]; code = pr_Initialize(0, AFSDIR_CLIENT_ETC_DIRPATH, cellconfig->name); if (code) diff --git a/src/vol/voldefs.h b/src/vol/voldefs.h index 57bebe633..813740450 100644 --- a/src/vol/voldefs.h +++ b/src/vol/voldefs.h @@ -69,7 +69,7 @@ #define VHDRNAMELEN (VFORMATDIGITS + 1 + sizeof(VHDREXT) - 1) /* must match VFORMAT */ /* Maximum length (including trailing NUL) of a volume external path name. */ -#define VMAXPATHLEN 64 +#define VMAXPATHLEN 512 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV) diff --git a/src/volser/restorevol.c b/src/volser/restorevol.c index 0f2887513..184951c62 100644 --- a/src/volser/restorevol.c +++ b/src/volser/restorevol.c @@ -800,8 +800,8 @@ WorkerBee(struct cmd_syndesc *as, void *arock) afs_int32 type, count, vcount; DIR *dirP, *dirQ; struct dirent *dirE, *dirF; - char name[MAXNAMELEN]; - char thisdir[MAXPATHLEN], *t; + char name[2*MAXNAMELEN+1]; + char thisdir[MAXPATHLEN+4], *t; struct DumpHeader dh; /* Defined in dump.h */ #if 0/*ndef HAVE_GETCWD*/ /* XXX enable when autoconf happens */ extern char *getwd();