mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-30 07:49:07 +08:00
Do not pass NULL to memcpy
-fsanitize=undefined pointed out a spot that passes NULL to memcpy, which is undefined behavior according to the C standard. gdb/ChangeLog 2018-10-03 Tom Tromey <tom@tromey.com> * namespace.c (add_using_directive): Don't pass NULL to memcpy.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2018-10-03 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* namespace.c (add_using_directive): Don't pass NULL to memcpy.
|
||||
|
||||
2018-10-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* tid-parse.c (tid_is_in_list): Fix wrong 'See' comment.
|
||||
|
@ -111,8 +111,9 @@ add_using_directive (struct using_direct **using_directives,
|
||||
else
|
||||
newobj->declaration = declaration;
|
||||
|
||||
memcpy (newobj->excludes, excludes.data (),
|
||||
excludes.size () * sizeof (*newobj->excludes));
|
||||
if (!excludes.empty ())
|
||||
memcpy (newobj->excludes, excludes.data (),
|
||||
excludes.size () * sizeof (*newobj->excludes));
|
||||
newobj->excludes[excludes.size ()] = NULL;
|
||||
|
||||
newobj->next = *using_directives;
|
||||
|
Reference in New Issue
Block a user