]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
venus: fix format overflow warning
authorMichael Meffie <mmeffie@sinenomine.net>
Mon, 19 Feb 2018 19:01:56 +0000 (14:01 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 3 Jun 2018 01:59:07 +0000 (21:59 -0400)
Recent versions of gcc generate a format overflow warning on the dfstring
buffer in fs.c.  Increase the size of the buffer to avoid a possible buffer
overflow.

    fs.c: In function ‘AclToString’:
    fs.c:770:30: error: ‘%s’ directive writing up to 1024 bytes
    into a region of size between 13 and 23 [-Werror=format-overflow=]
      sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell);
                                  ^~
    fs.c:770:2: note: ‘sprintf’ output between 8 and 1042 bytes into
    a destination of size 30
      sprintf(dfsstring, " dfs:%d %s", acl->dfs, acl->cell);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-on: https://gerrit.openafs.org/12917
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit c84f36a9b8c6b6adb9c77bab1c814ccd3aaf6a5b)

Change-Id: I05bef3e09455377364a014b41de1e047f5322c8b
Reviewed-on: https://gerrit.openafs.org/13099
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/venus/fs.c

index a0dfa9a26fe10407d96333017b86d853c87ff119..ef9d4dbd0f11a6ae9cbf6e3c28e58daad03ad8b4 100644 (file)
@@ -763,7 +763,7 @@ AclToString(struct Acl *acl)
 {
     static char mydata[AFS_PIOCTL_MAXSIZE];
     char tstring[AFS_PIOCTL_MAXSIZE];
-    char dfsstring[30];
+    char dfsstring[AFS_PIOCTL_MAXSIZE];
     struct AclEntry *tp;
 
     if (acl->dfs)