mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
sockets: fix incorrect malloc size
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
This commit is contained in:
parent
749eb33a92
commit
5c4cc46fdc
1 changed files with 4 additions and 1 deletions
|
|
@ -414,12 +414,15 @@ static int restore_socket_filter(int sk, SkOptsEntry *soe)
|
|||
|
||||
pr_info("Restoring socket filter\n");
|
||||
sfp.len = soe->n_so_filter;
|
||||
sfp.filter = xmalloc(soe->n_so_filter * sfp.len);
|
||||
sfp.filter = xmalloc(sfp.len * sizeof(struct sock_filter));
|
||||
if (!sfp.filter)
|
||||
return -1;
|
||||
|
||||
decode_filter(soe->so_filter, sfp.filter, sfp.len);
|
||||
ret = restore_opt(sk, SOL_SOCKET, SO_ATTACH_FILTER, &sfp);
|
||||
if (ret)
|
||||
pr_err("Can't restore filter\n");
|
||||
|
||||
xfree(sfp.filter);
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue