From: Michael Snyder Date: Tue, 1 Mar 2011 01:44:24 +0000 (+0000) Subject: 2011-02-28 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28288541273e5c304eb056f4f408546dd0bdc75b;p=binutils-gdb.git 2011-02-28 Michael Snyder * objc-lang.c (selectors_info): Add a small safety margin to avoid overflow. (classes_info): Error out on too long REGEXP. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90e9c001359..b1b8bf9d0a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2011-02-28 Michael Snyder + * objc-lang.c (selectors_info): Add a small safety margin to + avoid overflow. + (classes_info): Error out on too long REGEXP. + * infrun.c (handle_inferior_event): Remove unused function call. * fork-child.c (fork_inferior): Remove ifdef'd code and diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 26b7fb1d124..d656044c7fd 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -720,7 +720,7 @@ selectors_info (char *regexp, int from_tty) strcpy(myregexp, ".*]"); else { - if (sizeof (myregexp) < strlen (regexp) + 1) + if (sizeof (myregexp) < strlen (regexp) + 4) error (_("Regexp is too long: %s"), regexp); strcpy(myregexp, regexp); if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */ @@ -863,6 +863,8 @@ classes_info (char *regexp, int from_tty) strcpy(myregexp, ".* "); /* Null input: match all objc classes. */ else { + if (sizeof (myregexp) < strlen (regexp) + 4) + error (_("Regexp is too long: %s"), regexp); strcpy(myregexp, regexp); if (myregexp[strlen(myregexp) - 1] == '$') /* In the method name, the end of the class name is marked by ' '. */