From 3d0f55e41908a489f3d7e0cbe2c0d20de7e131c0 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sun, 24 Jan 2016 01:46:40 +0300 Subject: [PATCH] unix_parse_response: add a safety check * socketutils.c (unix_parse_response): Check that netlink message is large enough to contain a unix_diag_msg structure. --- socketutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/socketutils.c b/socketutils.c index 2f4a9b03..67fc1ee7 100644 --- a/socketutils.c +++ b/socketutils.c @@ -245,6 +245,8 @@ unix_parse_response(const char *proto_name, const void *data, int data_len, size_t path_len = 0; char path[UNIX_PATH_MAX + 1]; + if (rta_len < 0) + return false; if (diag_msg->udiag_ino != inode) return false; if (diag_msg->udiag_family != AF_UNIX) -- 2.40.0