From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20465 invoked by alias); 4 Nov 2009 13:26:35 -0000 Received: (qmail 20453 invoked by uid 22791); 4 Nov 2009 13:26:34 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-out4.blueyonder.co.uk (HELO smtp-out4.blueyonder.co.uk) (195.188.213.7) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Nov 2009 13:26:30 +0000 Received: from [172.23.170.146] (helo=anti-virus03-09) by smtp-out4.blueyonder.co.uk with smtp (Exim 4.52) id 1N5fsZ-0000Ts-LI for gdb-patches@sourceware.org; Wed, 04 Nov 2009 13:26:27 +0000 Received: from [94.169.168.163] (helo=JonPC) by asmtp-out4.blueyonder.co.uk with esmtp (Exim 4.52) id 1N5fsU-0006nv-5u for gdb-patches@sourceware.org; Wed, 04 Nov 2009 13:26:22 +0000 From: "Jon Beniston" To: Subject: [PATCH] Don't split executable paths with spaces in into multiple arguments Date: Wed, 04 Nov 2009 13:26:00 -0000 Message-ID: <003c01ca5d52$1715da50$45418ef0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-11/txt/msg00078.txt.bz2 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 * 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);