Fix a few things spotted by the gcc-6 sanitizer. Needs review.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-09-21 00:35:51 +02:00
parent ffa0efc898
commit 1bb0fa1809
3 changed files with 9 additions and 2 deletions
+2 -1
View File
@@ -69,7 +69,8 @@ ElfLinker::Section::Section(const char *n, const void *i, unsigned s, unsigned a
assert(name != NULL);
input = malloc(s + 1);
assert(input != NULL);
memcpy(input, i, s);
if (s != 0)
memcpy(input, i, s);
((char *)input)[s] = 0;
}