I'm working from master and using instrumented builds. Building on Ubuntu 18.04 with UBsan:
libtool: compile: gcc -I. -DSRCDIR=. -DNDEBUG -g2 -O3 -fsanitize=undefined -fno-sanitize-recover -pthread -c daemon/remote.c -fPIC -DPIC -o .libs/remote.o
daemon/remote.c: In function ‘do_stats’:
daemon/remote.c:965:38: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(nm, sizeof(nm), "OPCODE%d", i);
In file included from /usr/include/stdio.h:862:0,
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 8 and 17 bytes into a destination of size 16
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
__bos (__s), __fmt, __va_arg_pack ());
You can setup the test rig by exporting CFLAGS with UBsan enabled:
$ git clone https://github.com/NLnetLabs/unbound.git
$ cd unbound
$ export CFLAGS="-DNDEBUG -g2 -O3 -fsanitize=undefined -fno-sanitize-recover"
$ make test
The text was updated successfully, but these errors were encountered:
Thanks, I guess the buffer increase in the commit 348e246 should do the trick. Nice that it tests for potential buffer exceeded for the fixed strings. In practice this statistics counter probably does not get to maxint, but it is good to fix anyway.