2011-03-02 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 2 Mar 2011 22:56:44 +0000 (22:56 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 2 Mar 2011 22:56:44 +0000 (22:56 +0000)
* printcmd.c (print_scalar_formatted): Use strncpy for safety.

gdb/ChangeLog
gdb/printcmd.c

index 51c509239fe07286650a805ba9e6a6fb7998c52e..ae76da176abc1c52e5355cc252f904276dbfea3a 100644 (file)
@@ -1,5 +1,7 @@
 2011-03-02  Michael Snyder  <msnyder@vmware.com>
 
+       * printcmd.c (print_scalar_formatted): Use strncpy for safety.
+
        * infcall.c (call_function_by_hand): Add break statements for lint.
 
        * utils.c (parse_escape): Escape the escape char.
index e78acb39a5650b97c38086c07962595da83d92a4..12249a004b0fe5b3c55d8ae21723e3b44b9673c9 100644 (file)
@@ -533,7 +533,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
            if (*cp == '\0')
              cp--;
          }
-       strcpy (buf, cp);
+       strncpy (buf, cp, sizeof (bits));
        fputs_filtered (buf, stream);
       }
       break;