X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-rtnl%2Frtnl-message.c;h=fb429864b94c09776433d4b82f1feea3318b8569;hp=d611207deab2c76bd157aa279b451c699fc8f89b;hb=127dc4ea9487397b1ab70447e2f44d091e44ab5f;hpb=897e184c7d54156357fd204beafe06ab9bd0341a diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index d611207de..fb429864b 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -1154,10 +1154,6 @@ int socket_read_message(sd_rtnl *rtnl) { else len = (size_t)r; - if (len > rtnl->rbuffer_allocated) - /* message did not fit in read buffer */ - return -EIO; - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS && @@ -1176,6 +1172,10 @@ int socket_read_message(sd_rtnl *rtnl) { /* not from the kernel, ignore */ return 0; + if (len > rtnl->rbuffer_allocated) + /* message did not fit in read buffer */ + return -EIO; + if (NLMSG_OK(rtnl->rbuffer, len) && rtnl->rbuffer->nlmsg_flags & NLM_F_MULTI) { multi_part = true;