aboutsummaryrefslogtreecommitdiff
path: root/gdb/objc-lang.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-03-01 01:44:24 +0000
committerMichael Snyder <msnyder@vmware.com>2011-03-01 01:44:24 +0000
commit28288541273e5c304eb056f4f408546dd0bdc75b (patch)
tree367a09f61cbf2792aa6bbf0af9bb0b9e2ce6aca5 /gdb/objc-lang.c
parent098ab5127c7d086fa3eaf18e936346d2a6970646 (diff)
downloadgdb-28288541273e5c304eb056f4f408546dd0bdc75b.zip
gdb-28288541273e5c304eb056f4f408546dd0bdc75b.tar.gz
gdb-28288541273e5c304eb056f4f408546dd0bdc75b.tar.bz2
2011-02-28 Michael Snyder <msnyder@vmware.com>
* objc-lang.c (selectors_info): Add a small safety margin to avoid overflow. (classes_info): Error out on too long REGEXP.
Diffstat (limited to 'gdb/objc-lang.c')
-rw-r--r--gdb/objc-lang.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 26b7fb1..d656044 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 ' '. */