summaryrefslogtreecommitdiff
path: root/lib/nl.c
diff options
context:
space:
mode:
authorAndrew Vagin <avagin@virtuozzo.com>2015-11-23 17:23:20 +0300
committerThomas Haller <thaller@redhat.com>2015-11-24 13:44:48 +0100
commit7bbd09d9410f5fc0d22f00db26306234a50217a2 (patch)
tree351bc1474e3e8e198ba1bd6da91f5d0989360c43 /lib/nl.c
parentef32af0f6afd2a0e503d5c535c5e105d76d64629 (diff)
downloadlibnl-7bbd09d9410f5fc0d22f00db26306234a50217a2.tar.gz
libnl: don't use out-of-scope buffer in nl_send_iovec()
The control message buffer is desclared in the if body and then this buffer is used outside. http://lists.infradead.org/pipermail/libnl/2015-November/002013.html Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/nl.c')
-rw-r--r--lib/nl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/nl.c b/lib/nl.c
index cba42170..2d1ce81c 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -384,6 +384,7 @@ int nl_send_iovec(struct nl_sock *sk, struct nl_msg *msg, struct iovec *iov, uns
.msg_iov = iov,
.msg_iovlen = iovlen,
};
+ char buf[CMSG_SPACE(sizeof(struct ucred))];
/* Overwrite destination if specified in the message itself, defaults
* to the peer address of the socket.
@@ -395,7 +396,6 @@ int nl_send_iovec(struct nl_sock *sk, struct nl_msg *msg, struct iovec *iov, uns
/* Add credentials if present. */
creds = nlmsg_get_creds(msg);
if (creds != NULL) {
- char buf[CMSG_SPACE(sizeof(struct ucred))];
struct cmsghdr *cmsg;
hdr.msg_control = buf;