Fix CID 1491385: buffer overrun (if copying all non-0 chars of name to newname, we...
authorwwp <subscript@free.fr>
Sat, 11 Sep 2021 12:20:08 +0000 (14:20 +0200)
committerwwp <subscript@free.fr>
Sat, 11 Sep 2021 12:21:05 +0000 (14:21 +0200)
need an extra room for a trailing 0).

src/grouplistdialog.c

index 0ec451f83de4e1d7f04c499af59d23b7fdf18389..2ed3522912242b79c997ad9bdda9488d7ceb9d2f 100644 (file)
@@ -378,7 +378,7 @@ static GtkCMCTreeNode *grouplist_create_branch(NewsGroupInfo *ginfo,
 
 static void grouplist_expand_upwards(GtkCMCTree *ctree, const gchar *name) {
        const gchar *ptr;
-       gchar *newname=g_malloc0(strlen(name));
+       gchar *newname=g_malloc0(strlen(name) + 1);
        GtkCMCTreeNode *node;
 
        for (ptr=name; *ptr; ptr++) {