netlink: move NLMSG_ERROR payload length check to nlmsgerr decoder
Move decoder specific check to the decoder. * netlink.c (decode_payload): Move NLMSG_ERROR payload length check ... (decode_nlmsgerr): ... here.
This commit is contained in:
parent
32cff9dc88
commit
28e478a6eb
12
netlink.c
12
netlink.c
@ -83,6 +83,11 @@ decode_nlmsgerr(struct tcb *const tcp,
|
||||
{
|
||||
struct nlmsgerr err;
|
||||
|
||||
if (len < sizeof(err.error)) {
|
||||
printstrn(tcp, addr, len);
|
||||
return;
|
||||
}
|
||||
|
||||
if (umove_or_printaddr(tcp, addr, &err.error))
|
||||
return;
|
||||
|
||||
@ -112,11 +117,12 @@ decode_payload(struct tcb *const tcp,
|
||||
const kernel_ulong_t addr,
|
||||
const kernel_ulong_t len)
|
||||
{
|
||||
if (nlmsghdr->nlmsg_type == NLMSG_ERROR && len >= sizeof(int)) {
|
||||
if (nlmsghdr->nlmsg_type == NLMSG_ERROR) {
|
||||
decode_nlmsgerr(tcp, addr, len);
|
||||
} else {
|
||||
printstrn(tcp, addr, len);
|
||||
return;
|
||||
}
|
||||
|
||||
printstrn(tcp, addr, len);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user