]> granicus.if.org Git - multimarkdown/commitdiff
FIXED: Prevent pointer overflow
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Sun, 12 Nov 2017 13:46:55 +0000 (08:46 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Sun, 12 Nov 2017 13:46:55 +0000 (08:46 -0500)
Sources/libMultiMarkdown/transclude.c

index c828e470916f15234886fa94c491013061530106..3321a7a3eaa79bc795f17f3cf9ae3646e0421b28 100644 (file)
@@ -144,7 +144,7 @@ void add_trailing_sep(DString * path) {
        #endif
 
        // Ensure that folder ends in separator
-       if (!is_separator(path->str[path->currentStringLength - 1])) {
+       if ((path->currentStringLength == 0) || (!is_separator(path->str[path->currentStringLength - 1]))) {
                d_string_append_c(path, sep);
        }
 }