From a6175a39891646c1e018eaef773d9516453dd2d7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 5 Jun 2016 19:04:59 +0200 Subject: [PATCH] (menu_cbs_ok.c) Fix explicit NULL dereferenced warnings --- menu/cbs/menu_cbs_ok.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 3f3f8726e5..e914303908 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -317,8 +317,10 @@ int generic_action_ok_displaylist_push(const char *path, break; } - strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf)); - strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf)); + if (!string_is_empty(path)) + strlcpy(menu->scratch_buf, path, sizeof(menu->scratch_buf)); + if (!string_is_empty(menu_path)) + strlcpy(menu->scratch2_buf, menu_path, sizeof(menu->scratch2_buf)); break; case ACTION_OK_DL_PARENT_DIRECTORY_PUSH: fill_pathname_parent_dir(parent_dir, @@ -1417,8 +1419,9 @@ static void cb_generic_download(void *task_data, goto finish; } - fill_pathname_join(output_path, dir_path, - transf->path, sizeof(output_path)); + if (!string_is_empty(dir_path)) + fill_pathname_join(output_path, dir_path, + transf->path, sizeof(output_path)); #ifdef HAVE_ZLIB file_ext = path_get_extension(output_path);