Fix ugly possible segfault.

This commit is contained in:
Themaister 2011-10-30 16:58:45 +01:00
parent 202a458524
commit a48dc55c41

2
file.c
View File

@ -510,7 +510,7 @@ void load_ram_file(const char *path, int type)
void *buf = NULL;
ssize_t rc = read_file(path, &buf);
if (rc <= size)
memcpy(data, buf, size);
memcpy(data, buf, rc);
free(buf);
}