|
From: Leonard m. <spa...@ya...> - 2003-06-10 12:41:27
|
I extracted a valgrind-flagged problem into this simple little C
program:
#include <string.h>
int main()
{
char buffer[ 1024 ];
char name [ 64 ];
strcpy( buffer, "[" );
strcpy( name, "why did the chicken cross the road" );
strcat( name, buffer );
}
valgrind CVS says:
==3194== Source and destination overlap in strcat(0xbfffede0,
0xbfffee20)
==3194== at 0x40022FD4: strcat (mc_replace_strmem.c:59)
==3194== by 0x8048412: main (tst.C:10)
==3194== by 0x4031D4A1: __libc_start_main (in /lib/libc.so.6)
==3194== by 0x8048320: (within /home/rhh/tst)
Hmmm... Either I need more coffee this morning (a distinct
possibility), or this could be a valgrind bug.
Randall
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
|
|
From: Nicholas N. <nj...@ca...> - 2003-06-10 13:48:12
|
On Tue, 10 Jun 2003, Leonard mckinley wrote:
> I extracted a valgrind-flagged problem into this simple little C
> program:
>
> #include <string.h>
>
> int main()
> {
> char buffer[ 1024 ];
> char name [ 64 ];
>
> strcpy( buffer, "[" );
> strcpy( name, "why did the chicken cross the road" );
> strcat( name, buffer );
> }
>
> valgrind CVS says:
>
> ==3194== Source and destination overlap in strcat(0xbfffede0,0xbfffee20)
> ==3194== at 0x40022FD4: strcat (mc_replace_strmem.c:59)
> ==3194== by 0x8048412: main (tst.C:10)
> ==3194== by 0x4031D4A1: __libc_start_main (in /lib/libc.so.6)
> ==3194== by 0x8048320: (within /home/rhh/tst)
>
> Hmmm... Either I need more coffee this morning (a distinct
> possibility), or this could be a valgrind bug.
You're right, it's now fixed (I think/hope) in CVS. Thanks for the
report.
N
|
|
From: Dan K. <da...@ke...> - 2003-06-10 18:03:51
|
Leonard mckinley wrote:
> #include <string.h>
>
> int main()
> {
> char buffer[ 1024 ];
> char name [ 64 ];
>
> strcpy( buffer, "[" );
> strcpy( name, "why did the chicken cross the road" );
> strcat( name, buffer );
> }
Say, isn't name uninitialized there?
- Dan
--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
|
|
From: Morten E. <mo...@si...> - 2003-06-11 06:07:19
|
* Leonard mckinley: > > [snip] > char name [ 64 ]; > > strcpy( buffer, "[" ); > strcpy( name, "why did the chicken cross the road" ); > [snip] * Dan Kegel: > > Say, isn't name uninitialized there? No, initialization happens with the strcpy( name, "why did the chicken cross the road" ); statement. Morten |
|
From: Dan K. <da...@ke...> - 2003-06-11 07:08:12
|
Morten Eriksen wrote: > * Leonard mckinley: > >>[snip] >> char name [ 64 ]; >> >> strcpy( buffer, "[" ); >> strcpy( name, "why did the chicken cross the road" ); >>[snip] > > > * Dan Kegel: > >>Say, isn't name uninitialized there? Sorry, my eyes say "strcat" instead of "strcpy". Guess I should check my posts more thoroughly! - Dan -- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045 |