From 7984e9be606f2d2ab3c6df27f5cafcae908640b3 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 19 Dec 2018 14:34:38 +0900 Subject: Fix segmentation fault during network tranfer Since 'chunk' which is unit of transfer is not initialized, aio_read() is failed with invalid argument error. Moreover, in this case, chunk.nh is even NULL, so chunk->nh->sock_fd cause segmentation fault. Thus, this patch fixes to initialize chunk properly, and make chunk.nh have network handler pointer. Change-Id: I322a01ca99829eb928f26488a341cdaee1c4d9e2 Signed-off-by: Dongwoo Lee --- libthor/thor_net.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libthor/thor_net.c b/libthor/thor_net.c index a3e8a8f..ba044be 100644 --- a/libthor/thor_net.c +++ b/libthor/thor_net.c @@ -339,6 +339,8 @@ static int thor_net_send_raw_data(thor_device_handle *th, transfer.ret = 0; /* Init chunk */ + memset(&chunk, 0, sizeof(struct t_thor_net_chunk)); + chunk.nh = nh; chunk.user_data = &transfer; chunk.useful_size = 0; chunk.trans_unit_size = trans_unit_size; -- cgit v1.2.3