mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 09:20:13 -04:00
tools: ynl: handle calloc failure in ynl_ntf_parse
Check the return value of calloc() before dereferencing the allocated response structure in ynl_ntf_parse(). Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com> Link: https://patch.msgid.link/20260818132739.469624-1-triet.hoang.dev@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
4c660ee8c8
commit
25b863cd6d
@@ -889,6 +889,9 @@ static int ynl_ntf_parse(struct ynl_sock *ys, const struct nlmsghdr *nlh)
|
||||
return YNL_PARSE_CB_ERROR;
|
||||
|
||||
rsp = calloc(1, info->alloc_sz);
|
||||
if (!rsp)
|
||||
return YNL_PARSE_CB_ERROR;
|
||||
|
||||
rsp->free = info->free;
|
||||
yarg.data = rsp->data;
|
||||
yarg.rsp_policy = info->policy;
|
||||
|
||||
Reference in New Issue
Block a user