From: Michael Göhler Date: Wed, 27 Dec 2017 21:48:39 +0000 (+0100) Subject: fixed heap-buffer-overflow in url_count_inline, fixes #122 X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=38d6a34dd282abfa10f7d083a3f8161f0649acea;p=smdp.git fixed heap-buffer-overflow in url_count_inline, fixes #122 --- diff --git a/src/url.c b/src/url.c index 0e49b49..da21a57 100644 --- a/src/url.c +++ b/src/url.c @@ -165,7 +165,7 @@ int url_count_inline(const wchar_t *line) { for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) { @@ -185,7 +185,7 @@ int url_len_inline(const wchar_t *value) { for (; *i; i++) { if (*i == '\\') { i++; - } else if ( *i == '[' && *(i+1) != ']') { + } else if ( *i == '[' && *(i+1) && *(i+1) != ']') { while (*i && *i != ']') i++; i++; if (*i == '(' && wcschr(i, ')')) {