2011-02-27 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Mon, 28 Feb 2011 02:14:50 +0000 (02:14 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 28 Feb 2011 02:14:50 +0000 (02:14 +0000)
* objc-lang.c (selectors_info): Prevent string overrun.

gdb/ChangeLog
gdb/objc-lang.c

index 941c6113309b74a180a741d540123484c62d9dec..041543b310f1a007840411f5e92d35568940f9a2 100644 (file)
@@ -1,5 +1,7 @@
 2011-02-27  Michael Snyder  <msnyder@vmware.com>
 
+       * objc-lang.c (selectors_info): Prevent string overrun.
+
        * tui/tui-stack.c (tui_get_function_from_frame): Fix off by one
        error in strncpy.
 
index 25e13be5cf60e87ef5015a2241b6a6b1c6b1ae58..d795104986b0e8d93d6f6a5aa412aa27d97284f1 100644 (file)
@@ -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