fix potential crash on task_push_http_transfer

This commit is contained in:
radius 2018-03-18 12:51:20 -05:00
parent a8fc4b204a
commit fd9d8c9512
3 changed files with 2874 additions and 852 deletions

View File

@ -2090,7 +2090,7 @@ MSG_HASH(MSG_DISK_EJECTED,
MSG_HASH(MSG_DOWNLOADING, MSG_HASH(MSG_DOWNLOADING,
"Downloading") "Downloading")
MSG_HASH(MSG_INDEX_FILE, MSG_HASH(MSG_INDEX_FILE,
"Index File") "index")
MSG_HASH(MSG_DOWNLOAD_FAILED, MSG_HASH(MSG_DOWNLOAD_FAILED,
"Download failed") "Download failed")
MSG_HASH(MSG_ERROR, MSG_HASH(MSG_ERROR,

File diff suppressed because it is too large Load Diff

View File

@ -249,7 +249,7 @@ static void* task_push_http_transfer_generic(
{ {
task_finder_data_t find_data; task_finder_data_t find_data;
char tmp[255]; char tmp[255];
char* s = NULL; const char* s = NULL;
retro_task_t *t = NULL; retro_task_t *t = NULL;
http_handle_t *http = NULL; http_handle_t *http = NULL;
@ -298,7 +298,10 @@ static void* task_push_http_transfer_generic(
t->user_data = user_data; t->user_data = user_data;
t->progress = -1; t->progress = -1;
s= ((file_transfer_t*)user_data)->path; if (user_data != NULL)
s = ((file_transfer_t*)user_data)->path;
else
s = url;
if (strstr(s, ".index")) if (strstr(s, ".index"))
{ {
@ -307,7 +310,7 @@ static void* task_push_http_transfer_generic(
} }
else else
snprintf(tmp, sizeof(tmp), "%s '%s'", snprintf(tmp, sizeof(tmp), "%s '%s'",
msg_hash_to_str(MSG_DOWNLOADING), path_basename(s)); msg_hash_to_str(MSG_DOWNLOADING), s);
t->title = strdup(tmp); t->title = strdup(tmp);