Skip to contentSkip to conversation

ipvsadm: Fix buffer overrun in ipvs_dests_parse_cb() (bnc#775051)

PATCH Applied Tim Serong 2 participants 2 messages Sep 18, 2012 IPVS

lore
Share & tools
lore

Tim Serong

author
#0 lore raw

PATCH 1/1 ipvsadm: Fix buffer overrun in ipvs_dests_parse_cb() (bnc#775051)

The attrs and dest_attrs arrays in ipvs_dest_parse_cb() seem to be using the wrong defines for their length. This resulted in a buffer overrun corrupting EBX, which later caused a segfault running 'ipvsadm -Ln' on 32 bit intel (SLES 11 SP2).

---
 libipvs/ip_vs.h   |    2 +-
 libipvs/libipvs.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
libipvs/ip_vs.h +1 -1
index 9726a17..5e1d544 100644
@@ -413,7 +413,7 @@ enum {
 	__IPVS_CMD_ATTR_MAX,
 };
 
-#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
+#define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
 
 /*
  * Attributes used to describe a service
libipvs/libipvs.c +2 -2
index a157e18..be34dbc 100644
@@ -726,8 +726,8 @@ ipvs_sort_services(struct ip_vs_get_services *s, ipvs_service_cmp_t f)
 static int ipvs_dests_parse_cb(struct nl_msg *msg, void *arg)
 {
 	struct nlmsghdr *nlh = nlmsg_hdr(msg);
-	struct nlattr *attrs[IPVS_DEST_ATTR_MAX + 1];
-	struct nlattr *dest_attrs[IPVS_SVC_ATTR_MAX + 1];
+	struct nlattr *attrs[IPVS_CMD_ATTR_MAX + 1];
+	struct nlattr *dest_attrs[IPVS_DEST_ATTR_MAX + 1];
 	struct ip_vs_get_dests **dp = (struct ip_vs_get_dests **)arg;
 	struct ip_vs_get_dests *d = (struct ip_vs_get_dests *)*dp;
 	int i = d->num_dests;
Signature · 1 line
1.7.10.4
maintainer Applied
#1 lore raw
Quoted 6 lines · Tim Serong

The attrs and dest_attrs arrays in ipvs_dest_parse_cb() seem to be using the wrong defines for their length. This resulted in a buffer overrun corrupting EBX, which later caused a segfault running 'ipvsadm -Ln' on 32 bit intel (SLES 11 SP2).

Thanks, applied.