]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Avoid format truncation warnings
authorAndrew Deason <adeason@sinenomine.net>
Tue, 7 Aug 2018 22:27:24 +0000 (17:27 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Sun, 3 Feb 2019 14:01:01 +0000 (09:01 -0500)
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 <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 2daa413e3ec061e0653adbd1d6549f15e0659a62)

Change-Id: I61ae1ddae4b2d84147198a1dccb280d0da100a0b
Reviewed-on: https://gerrit.openafs.org/13459
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/aklog/klog.c
src/vol/voldefs.h
src/volser/restorevol.c

index 88e49070ae3b0b30749a5d82e883cf06093af4ab..9677ffad89b41e1fe34fcc3b1ff3eff546641aa5 100644 (file)
@@ -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)
index 57bebe6336fe4442475c33b27be3f96861900ce5..81374045066ff3914133cc936622244d4e7190a4 100644 (file)
@@ -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)
 
index 0f28875139da9886258577c244aa37df0e43c9a7..184951c62ff7c144dfdeb6d799d2575905a35bbc 100644 (file)
@@ -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();