1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* symbols.c (duplicate_string): Don't try to copy the byte after

the string.  This might not be `\0' and might even not be
allocated memory.
This commit is contained in:
Mikael Djurfeldt 2000-09-12 17:00:57 +00:00
parent 8e93e199f8
commit 1e1384f0bc

View file

@ -76,7 +76,8 @@ static char *
duplicate_string (const char * src, unsigned long length) duplicate_string (const char * src, unsigned long length)
{ {
char * dst = scm_must_malloc (length + 1, "duplicate_string"); char * dst = scm_must_malloc (length + 1, "duplicate_string");
memcpy (dst, src, length + 1); memcpy (dst, src, length);
dst[length] = 0;
return dst; return dst;
} }