RSSyl: Fix allocated buffer size in previous commit to include space for terminating...
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 27 Nov 2014 01:12:06 +0000 (02:12 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 27 Nov 2014 01:13:54 +0000 (02:13 +0100)
src/plugins/rssyl/strutils.c

index b2704d973e6ea12a0fd650b5c286389f691151fc..bfeef3402486eaf6850a364438bc2571648863c0 100644 (file)
@@ -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 {