diff options
author | Yao Qi <yao.qi@linaro.org> | 2016-09-23 17:27:26 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2016-09-23 17:27:26 +0100 |
commit | 97e64e5ab19dbf6a9babd711e8deec5545520954 (patch) | |
tree | 72a1b03360a716737551765c1a9a4affbc9b6355 /gdb/go32-nat.c | |
parent | 503b1c39dc801389f7ae510fb1f7ee1e533b67ac (diff) | |
download | binutils-gdb-97e64e5ab19dbf6a9babd711e8deec5545520954.tar.gz |
Replace sprintf with xsnprintf in nat/linux-osdata.c
I see the following build warning when I build GDB with GCC trunk.
../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_fds(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:767:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
linux_xfer_osdata_fds (gdb_byte *readbuf,
^~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:800:51: note: format output between 7 and 262 bytes into a destination of size 17
sprintf (procentry, "/proc/%s", dp->d_name);
^
../../binutils-gdb/gdb/nat/linux-osdata.c: In function ‘LONGEST linux_xfer_osdata_threads(gdb_byte*, ULONGEST, ULONGEST)’:
../../binutils-gdb/gdb/nat/linux-osdata.c:555:1: error: ‘%s’ directive writing between 0 and 255 bytes into a region of size 11 [-Werror=format-length=]
linux_xfer_osdata_threads (gdb_byte *readbuf,
^~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/nat/linux-osdata.c:588:51: note: format output between 7 and 262 bytes into a destination of size 17
sprintf (procentry, "/proc/%s", dp->d_name);
^
cc1plus: all warnings being treated as errors
The warning is a false positive, but we can workaround it by replacing
sprintf with xsnprintf. On the other hand, it is always preferred to
use xsnprintf.
gdb:
2016-09-23 Yao Qi <yao.qi@linaro.org>
* nat/linux-osdata.c (linux_xfer_osdata_threads): Replace
sprintf with xsnprintf.
(linux_xfer_osdata_fds): Likewise.
Diffstat (limited to 'gdb/go32-nat.c')
0 files changed, 0 insertions, 0 deletions