Also copy null termination

Signed-off-by: tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
tyrolyean 2020-04-29 00:47:58 +02:00
parent 8b0210010d
commit 71a4208434
No known key found for this signature in database
GPG Key ID: EDD105663B707C62
1 changed files with 2 additions and 1 deletions

View File

@ -39,7 +39,8 @@ char* insert_string(char * destination, const char* source,
/* Out of memory... Failed me.. */
return NULL;
}
memmove(result+offset+src_len, result+offset, dest_orig_len - offset);
memmove(result+offset+src_len, result+offset,
(dest_orig_len - offset+1));
memcpy(result+offset, source, src_len);
return result;