From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [commit] objc-lang.c: avoid string overrun
Date: Mon, 28 Feb 2011 04:10:00 -0000 [thread overview]
Message-ID: <4D6B0553.6010803@vmware.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: strncpy2.txt --]
[-- Type: text/plain, Size: 726 bytes --]
2011-02-27 Michael Snyder <msnyder@vmware.com>
* objc-lang.c (selectors_info): Prevent string overrun.
Index: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.91
diff -u -p -u -p -r1.91 objc-lang.c
--- objc-lang.c 10 Jan 2011 20:38:49 -0000 1.91
+++ objc-lang.c 28 Feb 2011 02:13:37 -0000
@@ -720,7 +720,7 @@ selectors_info (char *regexp, int from_t
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
next reply other threads:[~2011-02-28 2:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 4:10 Michael Snyder [this message]
2011-02-28 4:52 ` Jan Kratochvil
2011-02-28 18:02 ` Michael Snyder
2011-02-28 18:15 ` Jan Kratochvil
2011-02-28 12:21 ` Pedro Alves
2011-02-28 18:27 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D6B0553.6010803@vmware.com \
--to=msnyder@vmware.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox