diff --git a/src/config.c b/src/config.c index e1dacb32b..ce8ed3671 100644 --- a/src/config.c +++ b/src/config.c @@ -1032,18 +1032,21 @@ load_image_file(char *dest, char *p, uint8_t *ui_wp) } if (strstr(p, "wp://") == p) { - p += 5; - prefix = "wp://"; - if (ui_wp != NULL) - *ui_wp = 1; + p += 5; + prefix = "wp://"; + if (ui_wp != NULL) + *ui_wp = 1; } else if ((ui_wp != NULL) && *ui_wp) - prefix = "wp://"; + prefix = "wp://"; if (strstr(p, "ioctl://") == p) { - if (strlen(p) > (MAX_IMAGE_PATH_LEN - 11)) - ret = 1; - else - snprintf(dest, MAX_IMAGE_PATH_LEN, "%s", p); + if (strlen(p) > (MAX_IMAGE_PATH_LEN - 11)) + ret = 1; + else + snprintf(dest, MAX_IMAGE_PATH_LEN, "%s", p); + + if (above2 != NULL) + free(above2); if (above != NULL) free(above); @@ -1064,7 +1067,7 @@ load_image_file(char *dest, char *p, uint8_t *ui_wp) (MAX_IMAGE_PATH_LEN - 11)) ret = 1; else - snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, use, path_get_slash(use), p + strlen("../")); + snprintf(dest, MAX_IMAGE_PATH_LEN, "%s%s%s%s", prefix, use, path_get_slash(use), p + strlen("../../")); } else if (memcmp(p, "../", strlen("../")) == 0) { use = (above == NULL) ? usr_path : above; if ((strlen(prefix) + strlen(use) + strlen(path_get_slash(use)) + strlen(p + strlen("../"))) >