From: Andrej Kacian Date: Thu, 27 Nov 2014 01:12:06 +0000 (+0100) Subject: RSSyl: Fix allocated buffer size in previous commit to include space for terminating... X-Git-Tag: 3.12.0~210 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=23c0630c1c263783d9a4657bb64ad81fc6d86b05 RSSyl: Fix allocated buffer size in previous commit to include space for terminating null byte; Fix minor logic bug. --- diff --git a/src/plugins/rssyl/strutils.c b/src/plugins/rssyl/strutils.c index b2704d973..bfeef3402 100644 --- a/src/plugins/rssyl/strutils.c +++ b/src/plugins/rssyl/strutils.c @@ -152,7 +152,7 @@ static RSSyl_HTMLSymbol tag_list[] = { static gchar *rssyl_replace_chrefs(gchar *string) { - char *new = g_malloc0(strlen(string)), *ret; + char *new = g_malloc0(strlen(string) + 1), *ret; char buf[16], tmp[6]; int i, ii, j, n, len; gunichar c; @@ -165,7 +165,7 @@ static gchar *rssyl_replace_chrefs(gchar *string) j = i+1; n = 0; valid = FALSE; - while (string[j] != '\0' && j < 16) { + while (string[j] != '\0' && n < 16) { if (string[j] != ';') { buf[n++] = string[j]; } else {