Avoid overflow on ret

This commit is contained in:
Clément Bœsch 2011-02-23 20:57:01 +01:00
parent d79404f5ee
commit 9766392332

View File

@ -362,7 +362,7 @@ patht(char *path)
strncpy(ret, path, sizeof(ret));
ret[sizeof(ret) - 1] = 0;
if(strstr(path, "~/"))
sprintf(ret, "%s/%s", getenv("HOME"), path + 2);
snprintf(ret, sizeof(ret), "%s/%s", getenv("HOME"), path + 2);
return ret;
}