From a76633b930499ee9d7d47d6b438d5e0d2f780eea Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Mon, 5 Aug 2013 10:43:25 +0200 Subject: [PATCH] efreet: Fix allocated data size Since we check for count < 10 and then add 1, we could get count == 11. Also set array memory to 0 in one command. --- src/lib/efreet/efreet_xml.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/efreet/efreet_xml.c b/src/lib/efreet/efreet_xml.c index fbf14d78c2..9ec2c721e1 100644 --- a/src/lib/efreet/efreet_xml.c +++ b/src/lib/efreet/efreet_xml.c @@ -333,9 +333,10 @@ static void efreet_xml_attributes_parse(char **data, int *size, Efreet_Xml_Attribute ***attributes, int *error) { - Efreet_Xml_Attribute attr[10]; + Efreet_Xml_Attribute attr[11]; int i, count = 0; + memset(attr, sizeof(attr), 0); while (*size > 0) { if (**data == '>') @@ -351,9 +352,6 @@ efreet_xml_attributes_parse(char **data, int *size, char buf[256]; int buf_size; - attr[count].key = NULL; - attr[count].value = NULL; - start = *data; while ((*size > 0) && ((isalpha(**data)) || (**data == '_'))) {