You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "James Peach (JIRA)" <ji...@apache.org> on 2018/06/15 16:32:00 UTC

[jira] [Updated] (ZOOKEEPER-3064) Format overflow warning when building with GCC 8.1

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-3064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Peach updated ZOOKEEPER-3064:
-----------------------------------
    Summary: Format overflow warning when building with GCC 8.1  (was: Format overflow warning when building with Clang 6)

> Format overflow warning when building with GCC 8.1
> --------------------------------------------------
>
>                 Key: ZOOKEEPER-3064
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3064
>             Project: ZooKeeper
>          Issue Type: Task
>            Reporter: James Peach
>            Priority: Minor
>
> Building ZK 3.4.8 with gcc (GCC) 8.1.1 20180502 (Red Hat 8.1.1-1)
> {noformat}
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I./include -I./tests -I./generated -Wall -Werror -g -O2 -D_GNU_SOURCE -MT zookeeper.lo -MD -MP -MF .deps/zookeeper.Tpo -c src/zookeeper.c  -fPIC -DPIC -o zookeeper.o
> ...
> src/zookeeper.c: In function ‘format_endpoint_info’:
> src/zookeeper.c:3504:21: error: ‘%d’ directive writing between 1 and 5 bytes into a region of size between 0 and 127 [-Werror=format-overflow=]
>      sprintf(buf,"%s:%d",addrstr,ntohs(port));
>                      ^~
> src/zookeeper.c:3504:17: note: directive argument in the range [0, 65535]
>      sprintf(buf,"%s:%d",addrstr,ntohs(port));
>                  ^~~~~~~
> src/zookeeper.c:3504:5: note: ‘sprintf’ output between 3 and 134 bytes into a destination of size 128
>      sprintf(buf,"%s:%d",addrstr,ntohs(port));
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> {noformat}
> Looks like gcc wants [format_endpoint_info|https://github.com/apache/zookeeper/blob/master/src/c/src/zookeeper.c#L4357] to use snprintf.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)