aboutsummaryrefslogtreecommitdiff
path: root/gdb/sentinel-frame.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-05-17 12:55:18 -0600
committerTom Tromey <tromey@adacore.com>2021-05-17 13:06:05 -0600
commit591732169550b26608f186c9927f4cf9a47d99d5 (patch)
tree62cb2535ab510fa1d484933b042fe871dde85130 /gdb/sentinel-frame.h
parentbaea2f9d52d606f6b58a736420017c98351f5b5c (diff)
downloadgdb-591732169550b26608f186c9927f4cf9a47d99d5.zip
gdb-591732169550b26608f186c9927f4cf9a47d99d5.tar.gz
gdb-591732169550b26608f186c9927f4cf9a47d99d5.tar.bz2
Fix ubsan build
I tried a build using the undefined behavior sanitizer, and gcc gave this error: In file included from /usr/include/string.h:495, from ../gnulib/import/string.h:41, from ../../binutils-gdb/gdb/../gdbsupport/common-defs.h:95, from ../../binutils-gdb/gdb/nat/linux-osdata.c:20: In function 'char* strncpy(char*, const char*, size_t)', inlined from 'void time_from_time_t(char*, int, TIME_T)' at ../../binutils-gdb/gdb/nat/linux-osdata.c:923:15, inlined from 'void time_from_time_t(char*, int, TIME_T)' at ../../binutils-gdb/gdb/nat/linux-osdata.c:911:1, inlined from 'void linux_xfer_osdata_sem(buffer*)' at ../../binutils-gdb/gdb/nat/linux-osdata.c:1082:22: /usr/include/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 32 equals destination size [-Werror=stringop-truncation] This patch fixes the problem by subtracting one from the length parameter to strncpy. I changed a couple of other similar functions -- gcc does not warn about these, but I didn't see any substantial difference between the different cases, and I think these are just latent warnings, to be triggered in the future by a change to inlining heuristics. gdb/ChangeLog 2021-05-17 Tom Tromey <tromey@adacore.com> * nat/linux-osdata.c (user_from_uid, time_from_time_t) (group_from_gid): Subtract one from strncpy length.
Diffstat (limited to 'gdb/sentinel-frame.h')
0 files changed, 0 insertions, 0 deletions