This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Don't split executable paths with spaces in into multiple arguments
- From: "Jon Beniston" <jon at beniston dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 4 Nov 2009 13:24:08 -0000
- Subject: [PATCH] Don't split executable paths with spaces in into multiple arguments
Hi,
The following patch prevents executable paths with spaces in them from being
passed to the simulator as multiple arguments.
OK to apply?
Cheers,
Jon
gdb/
2009-11-04 Jon Beniston <jon@beniston.com>
* remote-sim.c(gdbsim_create_inferior) Quote executable path in case
it
contains spaces.
===================================================================
--- remote-sim.c (revision 41)
+++ remote-sim.c (working copy)
@@ -458,10 +458,13 @@
if (exec_file != NULL)
{
- len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
+ len = 2 + strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
arg_buf = (char *) alloca (len);
arg_buf[0] = '\0';
+ /* Add quotes around exec_file in case there are spaces in the path.
*/
+ strcat (arg_buf, "\"");
strcat (arg_buf, exec_file);
+ strcat (arg_buf, "\"");
strcat (arg_buf, " ");
strcat (arg_buf, args);
argv = buildargv (arg_buf);