diff options
author | Marc Gonzalez <mgonzalez@freebox.fr> | 2023-07-19 12:52:16 +0200 |
---|---|---|
committer | Mike Frysinger <vapier@chromium.org> | 2023-08-02 14:55:51 +0000 |
commit | 0d0354463ee36132e76c78e5ef10a6f08f641bfa (patch) | |
tree | 6e9c8c0214475d242684d3b25418cf4c6db4fb3c | |
parent | 9ea5b228f560580f85df895c2f117d7e43340935 (diff) | |
download | google-breakpad-0d0354463ee36132e76c78e5ef10a6f08f641bfa.tar.gz |
libdisasm: Widen STRNCATF temp buffer
The _tmp buffer used in STRNCATF is too small for several callers,
which might lead to truncated output in some situations.
For example, GCC 11 warns:
src/third_party/libdisasm/x86_format.c:899:40: warning: ‘%s’ directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=]
899 | STRNCATF( buf, "%s:", str, len );
| ^~~~~ ~~~
src/third_party/libdisasm/x86_format.c:34:38: note: in definition of macro ‘STRNCATF’
34 | snprintf( _tmp, sizeof _tmp, fmt, data ); \
| ^~~
src/third_party/libdisasm/x86_format.c:899:41: note: format string is defined here
899 | STRNCATF( buf, "%s:", str, len );
| ^~
In file included from /usr/include/stdio.h:894,
from src/third_party/libdisasm/x86_format.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 65 bytes into a destination of size 32
71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Change-Id: Ia876e288bf9629f2c72db3faf2287c7940924ea0
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4668735
Reviewed-by: Mike Frysinger <vapier@chromium.org>
-rw-r--r-- | src/third_party/libdisasm/x86_format.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/third_party/libdisasm/x86_format.c b/src/third_party/libdisasm/x86_format.c index 0ec960dc..bb547ad4 100644 --- a/src/third_party/libdisasm/x86_format.c +++ b/src/third_party/libdisasm/x86_format.c @@ -29,7 +29,7 @@ } while( 0 ) #define STRNCATF( buf, fmt, data, len ) do { \ - char _tmp[MAX_OP_STRING]; \ + char _tmp[MAX_OP_XML_STRING]; \ \ snprintf( _tmp, sizeof _tmp, fmt, data ); \ STRNCAT( buf, _tmp, len ); \ |