mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-23 13:21:43 +08:00
Fix possible bug when no args have been provided to the executable
Hi, This bug is related to: <https://sourceware.org/ml/gdb-patches/2017-06/msg00216.html> On stringify_argv, we have to check if args[0] is not NULL before stringifying anything, otherwise we might do the wrong thing when trimming the "ret" string in the end. args[0] will be NULL when no arguments are passed to the inferior that will be started. Checked in as obvious. gdb/ChangeLog: 2017-06-08 Sergio Durigan Junior <sergiodj@redhat.com> * common/common-utils.c (stringify_argv): Check for "arg[0] != NULL".
This commit is contained in:
parent
e3d1d4088a
commit
2f91880f3a
@ -1,3 +1,8 @@
|
||||
2017-06-08 Sergio Durigan Junior <sergiodj@redhat.com>
|
||||
|
||||
* common/common-utils.c (stringify_argv): Check for "arg[0] !=
|
||||
NULL".
|
||||
|
||||
2017-06-08 Alan Hayward <alan.hayward@arm.com>
|
||||
|
||||
* mn10300-tdep.c (MN10300_MAX_REGISTER_SIZE): Add.
|
||||
|
@ -337,7 +337,7 @@ stringify_argv (const std::vector<char *> &args)
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
if (!args.empty ())
|
||||
if (!args.empty () && args[0] != NULL)
|
||||
{
|
||||
for (auto s : args)
|
||||
if (s != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user