]> git.ozlabs.org Git - ccan/commitdiff
ttxml: zero terminate the buffer after checking it was allocated
authorDaniel Burke <dan.p.burke@gmail.com>
Fri, 9 Sep 2011 12:29:32 +0000 (21:59 +0930)
committerDaniel Burke <dan.p.burke@gmail.com>
Fri, 9 Sep 2011 12:29:32 +0000 (21:59 +0930)
ccan/ttxml/ttxml.c

index 03b101d6e8f951362c7cdacaf9a5a58e01bae15d..e953ba2390262cf221817671b261fc06cd7e77f0 100644 (file)
@@ -337,10 +337,10 @@ XmlNode* xml_load(const char * filename)
                return NULL;
 
        xml.buf = malloc(BUFFER+1);
-       xml.buf[BUFFER]=0;
-       xml.len = BUFFER;
        if(!xml.buf)
                goto xml_load_fail_malloc_buf;
+       xml.buf[BUFFER]=0;
+       xml.len = BUFFER;
        
        xml_read_file(&xml);