This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] tui/tui-stack.c: fix off-by-one in strncpy
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 27 Feb 2011 16:21:40 -0800
- Subject: [commit] tui/tui-stack.c: fix off-by-one in strncpy
2011-02-27 Michael Snyder <msnyder@vmware.com>
* tui/tui-stack.c (tui_get_function_from_frame): Fix off by one
error in strncpy.
Index: tui/tui-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-stack.c,v
retrieving revision 1.39
diff -u -p -u -p -r1.39 tui-stack.c
--- tui/tui-stack.c 6 Jan 2011 00:57:05 -0000 1.39
+++ tui/tui-stack.c 28 Feb 2011 00:19:11 -0000
@@ -227,7 +227,7 @@ tui_get_function_from_frame (struct fram
them because the status line is too short to display them. */
if (*p == '<')
p++;
- strncpy (name, p, sizeof (name));
+ strncpy (name, p, sizeof (name) - 1);
p = strchr (name, '(');
if (!p)
p = strchr (name, '>');