]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: warning, ‘%.16x’ directive output truncated writing 16 bytes into a region... 14292/head
authorJos Collin <jcollin@redhat.com>
Mon, 3 Apr 2017 03:59:33 +0000 (09:29 +0530)
committerJos Collin <jcollin@redhat.com>
Mon, 3 Apr 2017 03:59:38 +0000 (09:29 +0530)
The following warning appears during make.

    radosacl.cc:122:5: warning: ‘%.16x’ directive output truncated writing 16 bytes into a region of size 9 [-Wformat-truncation=]
     int main(int argc, const char **argv)
         ^~~~
                     from ./src/tools/radosacl.cc:19:
    /usr/include/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output 17 bytes into a destination of size 9
            __bos (__s), __fmt, __va_arg_pack ());

Signed-off-by: Jos Collin <jcollin@redhat.com>
src/tools/radosacl.cc

index 1eddef915ca2b6ae5020e46a834639c728bc97b1..882af2cae7e44d9da2e7309955fe869259a7a580 100644 (file)
@@ -151,7 +151,7 @@ int main(int argc, const char **argv)
 
   ACLID id;
 
-  snprintf(id.id, ID_SIZE + 1, "%.16x", 0x1234);
+  snprintf(id.id, sizeof(id.id), "%.8x", 0x1234);
   cout << "id=" << id.id << std::endl;
 
   r = io_ctx.exec(oid, "acl", "get", bl, bl2);