commit 23c0630c1c263783d9a4657bb64ad81fc6d86b05
parent 491667f21ad76f34145ac78e7682f115763fe1e0
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Thu, 27 Nov 2014 02:12:06 +0100
RSSyl: Fix allocated buffer size in previous commit to include space for terminating null byte; Fix minor logic bug.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git 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 {