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:
parent
8e93e199f8
commit
1e1384f0bc
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue