]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Fix potential crash in attribute parsing
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 14 Mar 2017 17:51:44 +0000 (13:51 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Tue, 14 Mar 2017 17:51:44 +0000 (13:51 -0400)
Sources/libMultiMarkdown/writer.c

index 853d355ad95b93b3f6babca17f56b7d347f17377..fc8e27b7aca9093b7f5aefff8bae6df979c83319 100644 (file)
@@ -532,7 +532,7 @@ attr * parse_attributes(char * source) {
        size_t scan_len;
        size_t pos = 0;
 
-       while (scan_attr(&source[pos])) {
+       while (source[pos] != '\0' && scan_attr(&source[pos])) {
                pos +=  scan_spnl(&source[pos]);
 
                // Get key
@@ -556,7 +556,7 @@ attr * parse_attributes(char * source) {
                        attributes = a;
                }
 
-               free(value);    // We stored a copy
+               free(value);    // We stored a modified copy
        }
 
        return attributes;