summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongwoo Lee <dwoo08.lee@samsung.com>2018-12-19 14:34:38 +0900
committerDongwoo Lee <dwoo08.lee@samsung.com>2018-12-19 14:49:49 +0900
commit7984e9be606f2d2ab3c6df27f5cafcae908640b3 (patch)
tree9e9eb62315758d28ae8149dc47ce380be5de44f7
parentdc4e3faafc7a7643cedd09903c3f9a3d51709127 (diff)
downloadlthor-7984e9be606f2d2ab3c6df27f5cafcae908640b3.tar.gz
lthor-7984e9be606f2d2ab3c6df27f5cafcae908640b3.tar.bz2
lthor-7984e9be606f2d2ab3c6df27f5cafcae908640b3.zip
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 <dwoo08.lee@samsung.com>
-rw-r--r--libthor/thor_net.c2
1 files changed, 2 insertions, 0 deletions
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;