VM: fix string copying to not use PATH_MAX here

locals-and-roots
Björn Lindqvist 2016-03-23 12:17:38 +01:00
parent e2e3b448ee
commit 83e1ee5084
1 changed files with 2 additions and 2 deletions

View File

@ -20,8 +20,8 @@ const char* default_image_path() {
return "factor.image";
int len = strlen(path);
char* new_path = new char[PATH_MAX + SUFFIX_LEN + 1];
memcpy(new_path, path, len + 1);
char* new_path = new char[len + SUFFIX_LEN + 1];
memcpy(new_path, path, len);
memcpy(new_path + len, SUFFIX, SUFFIX_LEN + 1);
free(const_cast<char*>(path));
return new_path;