cmd: lwip/wget: avoid NULL dereference in _set_cacert()
Running `wget cacert builtin` leads to a crash in _set_cacert():
Unhandled exception: Load access fault
Function _set_cacert() dereferences variable wget_info.
We must initialize it before executing the cacert sub-command.
Fixes: d3761a31ef ("lwip: split net/lwip/wget.c")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
committed by
Jerome Forissier
parent
8910efa71b
commit
a8a81af848
@@ -180,6 +180,8 @@ int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||||
ulong dst_addr;
|
||||
char nurl[1024];
|
||||
|
||||
wget_info = &default_wget_info;
|
||||
|
||||
#if CONFIG_IS_ENABLED(WGET_CACERT)
|
||||
if (argc == 4 && !strncmp(argv[1], "cacert", strlen("cacert")))
|
||||
return set_cacert(argv[2], argv[3]);
|
||||
@@ -214,7 +216,6 @@ int do_wget(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
|
||||
if (parse_legacy_arg(url, nurl, sizeof(nurl)))
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
wget_info = &default_wget_info;
|
||||
if (wget_do_request(dst_addr, nurl))
|
||||
return CMD_RET_FAILURE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user