diff options
author | Dongwoo Lee <dwoo08.lee@samsung.com> | 2018-12-19 14:34:38 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2018-12-19 15:44:32 +0900 |
commit | 53a8a099f20e7dd1c12fa498542167330eab2cc9 (patch) | |
tree | d35a3bfe96394d3704b9bd5e3d37fb3fe8d55968 | |
parent | 3e069f25737da3325f748acb308af77173b36518 (diff) | |
download | lthor-53a8a099f20e7dd1c12fa498542167330eab2cc9.tar.gz lthor-53a8a099f20e7dd1c12fa498542167330eab2cc9.tar.bz2 lthor-53a8a099f20e7dd1c12fa498542167330eab2cc9.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.c | 2 |
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; |