[PATCH] hawkbit: don't segfault on uninitialized channel_data->info

9 views
Skip to first unread message

Christian Storm

unread,
Mar 10, 2017, 12:02:28 PM3/10/17
to swup...@googlegroups.com, Christian Storm
If channel_data->info is not initialized by the caller of
channel_get_file(), i.e. NULL, SWupdate will segfault.
Give ipc_inst_start_ext() sensible parameters by checking
channel_data->info for NULL.

Signed-off-by: Christian Storm <christi...@siemens.com>
---
suricatta/channel_hawkbit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/suricatta/channel_hawkbit.c b/suricatta/channel_hawkbit.c
index 989e137..22c5860 100644
--- a/suricatta/channel_hawkbit.c
+++ b/suricatta/channel_hawkbit.c
@@ -668,7 +668,8 @@ channel_op_res_t channel_get_file(channel_t *this, void *data)
int file_handle = 0;
for (int retries = 3; retries >= 0; retries--) {
file_handle = ipc_inst_start_ext(SOURCE_SURICATTA,
- strlen(channel_data->info), channel_data->info);
+ channel_data->info == NULL ? 0 : strlen(channel_data->info),
+ channel_data->info);
if (file_handle > 0)
break;
sleep(1);
--
2.12.0

Stefano Babic

unread,
Mar 10, 2017, 1:01:50 PM3/10/17
to Christian Storm, swup...@googlegroups.com
Applied to -master, thanks !

Best regards,
Stefano Babic

--
Meet DENX at the Embedded World Trade Show
14 Mar - 16 Mar 2017, Nuremberg Trade Fair Centre, Hall 4, Booth 581
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================
Reply all
Reply to author
Forward
0 new messages