* [PATCH] Fix incorrect use of strcpy.
@ 2012-03-08 14:21 Chris January
2012-03-08 18:17 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Chris January @ 2012-03-08 14:21 UTC (permalink / raw)
To: gdb-patches
The strings passed to strcpy may not overlap, but &p and &p[len + 1]
clearly do. memmove allows overlapping memory area.
2012-03-08 Chris January <chris.january@allinea.com>
* source.c (add_path): Use memmove instead of strcpy because the
strings overlap.
---
diff --git a/gdb/source.c b/gdb/source.c
index cfdf81b..7505309 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -588,7 +588,7 @@ add_path (char *dirname, char **which_path, int
parse_separators)
p--; /* Back over leading separator. */
if (prefix > p - *which_path)
goto skip_dup; /* Same dir twice in one cmd. */
- strcpy (p, &p[len + 1]); /* Copy from next \0 or : */
+ memmove (p, &p[len + 1], strlen(&p[len + 1]) + 1); /* Copy from next
\0 or : */
}
p = strchr (p, DIRNAME_SEPARATOR);
if (p != 0)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix incorrect use of strcpy.
2012-03-08 14:21 [PATCH] Fix incorrect use of strcpy Chris January
@ 2012-03-08 18:17 ` Tom Tromey
2012-03-16 11:20 ` Chris January
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2012-03-08 18:17 UTC (permalink / raw)
To: Chris January; +Cc: gdb-patches
>>>>> "Chris" == Chris January <chris.january@allinea.com> writes:
Chris> The strings passed to strcpy may not overlap, but &p and &p[len + 1]
Chris> clearly do. memmove allows overlapping memory area.
This is ok. Thanks for doing this.
I think you should get started on your copyright assignment papers.
Your current patches are probably under the limit, but if you send more
then we'll need these.
Contact me off-list and I will send you the form.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix incorrect use of strcpy.
2012-03-08 18:17 ` Tom Tromey
@ 2012-03-16 11:20 ` Chris January
2012-03-16 18:20 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Chris January @ 2012-03-16 11:20 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Thu, 2012-03-08 at 11:17 -0700, Tom Tromey wrote:
> >>>>> "Chris" == Chris January <chris.january@allinea.com> writes:
>
> Chris> The strings passed to strcpy may not overlap, but &p and &p[len + 1]
> Chris> clearly do. memmove allows overlapping memory area.
Ping for commit?
> I think you should get started on your copyright assignment papers.
> Your current patches are probably under the limit, but if you send more
> then we'll need these.
We have a company-wide assignment on file.
Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix incorrect use of strcpy.
2012-03-16 11:20 ` Chris January
@ 2012-03-16 18:20 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2012-03-16 18:20 UTC (permalink / raw)
To: Chris January; +Cc: gdb-patches
>>>>> "Chris" == Chris January <chris.january@allinea.com> writes:
Chris> Ping for commit?
I checked it in.
If you have more patches you really should get write-after-approval
access.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-16 18:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08 14:21 [PATCH] Fix incorrect use of strcpy Chris January
2012-03-08 18:17 ` Tom Tromey
2012-03-16 11:20 ` Chris January
2012-03-16 18:20 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox