[SR-Users] [PATCH] Memory corruption using s.substr transformation

Alex Hermann alex at speakup.nl
Wed May 1 11:04:28 CEST 2013


On Tuesday 30 April 2013, Martin Mikkelsen wrote:
> This smells memory corruption. When run under valgrind, valgrind
> generates this error when that code is run:
> 
> ==1206== Source and destination overlap in strncpy(0x55e3b2a, 0x55e3b2b,
> 10) ==1206==    at 0x4C25ACF: strncpy (mc_replace_strmem.c:339)

strncpy() must be replaced with memmove() when src and dst (may) overlap.

-- 
Alex Hermann



More information about the sr-users mailing list