From 20937029912db1c246399ecf93fecae4117eeadf Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 28 Feb 2011 18:14:34 +0000 Subject: [PATCH] gdb/ * objc-lang.c (selectors_info): Error on too long REGEXP. --- gdb/ChangeLog | 4 ++++ gdb/objc-lang.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 13fd70f2356..e0be5211b42 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2011-02-28 Jan Kratochvil + + * objc-lang.c (selectors_info): Error on too long REGEXP. + 2011-02-28 Michael Snyder * linux-record.c (record_linux_system_call): Add missing diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index d795104986b..26b7fb1d124 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -720,7 +720,9 @@ selectors_info (char *regexp, int from_tty) strcpy(myregexp, ".*]"); else { - strncpy(myregexp, regexp, sizeof (myregexp) - 1); + if (sizeof (myregexp) < strlen (regexp) + 1) + error (_("Regexp is too long: %s"), regexp); + strcpy(myregexp, regexp); if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */ myregexp[strlen(myregexp) - 1] = ']'; /* end of method name */ else -- 2.30.2