Skip to content

Commit

Permalink
Fix for any command that passes strings to gdb for evaluation,
Browse files Browse the repository at this point in the history
where the string contains a parentheses-within-parentheses
expression along with a ">" or ">>" operator inside the outermost
set of parentheses.  Without the patch, a command such as the
following fails like so:

  crash> p ((1+1) >> 1)
  p: gdb request failed: p ((1+1)
  crash>

([email protected])
  • Loading branch information
Dave Anderson committed May 21, 2015
1 parent 042639e commit 3cbecbc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmdline.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* cmdline.c - core analysis suite
*
* Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
* Copyright (C) 2002-2014 David Anderson
* Copyright (C) 2002-2014 Red Hat, Inc. All rights reserved.
* Copyright (C) 2002-2015 David Anderson
* Copyright (C) 2002-2015 Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -497,13 +497,14 @@ setup_redirect(int origin)
if (FIRSTCHAR(p) == '|' || FIRSTCHAR(p) == '!')
pc->redirect |= REDIRECT_SHELL_COMMAND;

expression = string = FALSE;
expression = 0;
string = FALSE;

while (*p) {
if (*p == '(')
expression = TRUE;
expression++;
if (*p == ')')
expression = FALSE;
expression--;

if ((*p == '"') || (*p == '\''))
string = !string;
Expand Down

0 comments on commit 3cbecbc

Please sign in to comment.