diff options
author | Tom de Vries <tdevries@suse.de> | 2023-07-26 17:06:23 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-07-26 17:06:23 +0200 |
commit | 200546f1a33bd4e6d81d5bdef8d26836a7504bdb (patch) | |
tree | 9681bad2404e68c0654693938cf65eb545f876ed /gas/doc | |
parent | ac284430be5471a292eebd235266aca3e65a2de9 (diff) | |
download | binutils-200546f1a33bd4e6d81d5bdef8d26836a7504bdb.zip binutils-200546f1a33bd4e6d81d5bdef8d26836a7504bdb.tar.gz binutils-200546f1a33bd4e6d81d5bdef8d26836a7504bdb.tar.bz2 |
[gdb/build] Fix Wstringop-truncation in coff_getfilename
When building gdb with -O2 -fsanitize-threads, I ran into
a Werror=stringop-truncation.
The problem is here in coff_getfilename in coffread.c:
...
strncpy (buffer, aux_entry->x_file.x_n.x_fname, FILNMLEN);
buffer[FILNMLEN] = '\0';
...
The constant FILNMLEN is expected to designate the size of
aux_entry->x_file.x_n.x_fname, but that's no longer the case since commit
60ebc257517 ("Fixes a buffer overflow when compiling assembler for the MinGW
targets.").
Fix this by using "sizeof (aux_entry->x_file.x_n.x_fname)" instead.
Likewise in xcoffread.c.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
PR build/30669
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30669
Diffstat (limited to 'gas/doc')
0 files changed, 0 insertions, 0 deletions