liboping icon indicating copy to clipboard operation
liboping copied to clipboard

Fixes error reported by -Wformat-truncation

Open johnlepikhin opened this issue 4 years ago • 0 comments

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -Wall -Werror -g -O2 -c liboping.c  -fPIC -DPIC -o .libs/liboping_la-liboping.o
liboping.c: In function 'ping_host_add':
liboping.c:207:9: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 243 [-Werror=format-truncation=]
  207 |    "%s: %s", function, message);
      |         ^~
......
 1644 |    ping_set_error (obj, "getaddrinfo", errmsg);
      |                                        ~~~~~~
liboping.c:206:2: note: 'snprintf' output between 14 and 269 bytes into a destination of size 256
  206 |  snprintf (obj->errmsg, sizeof (obj->errmsg),
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  207 |    "%s: %s", function, message);
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

johnlepikhin avatar Dec 25 '21 16:12 johnlepikhin