From ae179fba639d227c015767db97740509515491f1 Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Mon, 28 Feb 2011 02:14:50 +0000 Subject: [PATCH] 2011-02-27 Michael Snyder * objc-lang.c (selectors_info): Prevent string overrun. --- gdb/ChangeLog | 2 ++ gdb/objc-lang.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 941c6113309..041543b310f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-02-27 Michael Snyder + * objc-lang.c (selectors_info): Prevent string overrun. + * tui/tui-stack.c (tui_get_function_from_frame): Fix off by one error in strncpy. diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 25e13be5cf6..d795104986b 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 { - strcpy(myregexp, regexp); + strncpy(myregexp, regexp, sizeof (myregexp) - 1); if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */ myregexp[strlen(myregexp) - 1] = ']'; /* end of method name */ else -- 2.30.2