Config: Add some sanity checks.
This commit is contained in:
@@ -825,12 +825,16 @@ load_image_file(char *dest, char *p, uint8_t *ui_wp)
|
|||||||
prefix = "wp://";
|
prefix = "wp://";
|
||||||
|
|
||||||
if (path_abs(p)) {
|
if (path_abs(p)) {
|
||||||
if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
|
if ((strlen(prefix) + strlen(p)) > (MAX_IMAGE_PATH_LEN - 1))
|
||||||
ret = 1;
|
ret = 1;
|
||||||
else
|
else
|
||||||
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s", prefix, p);
|
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s", prefix, p);
|
||||||
} else
|
} else {
|
||||||
|
if ((strlen(prefix) + strlen(usr_path) + strlen(path_get_slash(usr_path)) + strlen(p)) > (MAX_IMAGE_PATH_LEN - 1))
|
||||||
|
ret = 1;
|
||||||
|
else
|
||||||
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, usr_path, path_get_slash(usr_path), p);
|
snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, usr_path, path_get_slash(usr_path), p);
|
||||||
|
}
|
||||||
|
|
||||||
path_normalize(dest);
|
path_normalize(dest);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user