]> saetta.ns0.it Git - libzakcgi/commitdiff
Bugfix: missing last char on memdup in Main::get_stdin.
authorAndrea Zagli <azagli@libero.it>
Mon, 9 Sep 2019 09:08:09 +0000 (11:08 +0200)
committerAndrea Zagli <azagli@libero.it>
Mon, 9 Sep 2019 09:08:09 +0000 (11:08 +0200)
src/main.c

index 6bccb2f84d2376938e85098793cb5a145de22e32..953b79485f5d4455b2b2e9cfb27602a4440334a2 100644 (file)
@@ -601,6 +601,7 @@ static GHashTable
                {
                        qstring = query_string;
                }
+
        params = g_strsplit (qstring, "&", -1);
        l = g_strv_length (params);
        for (i = 0; i < l; i++)
@@ -639,7 +640,8 @@ static GHashTable
 
                                        g_value_init (gvaltmp, G_TYPE_STRING);
 
-                                       if (parts[1] == NULL
+                                       if (g_strv_length (parts) == 1
+                                           || parts[1] == NULL
                                            || g_strcmp0 (parts[1], "") == 0)
                                                {
                                                        g_value_set_string (gvaltmp, g_strdup (""));
@@ -660,7 +662,8 @@ static GHashTable
 
                                        g_value_init (gval, G_TYPE_STRING);
 
-                                       if (parts[1] == NULL
+                                       if (g_strv_length (parts) == 1
+                                           || parts[1] == NULL
                                            || g_strcmp0 (parts[1], "") == 0)
                                                {
                                                        g_value_set_string (gval, g_strdup (""));
@@ -806,7 +809,7 @@ gchar
 
        if (zakcgimain != NULL)
                {
-                       priv->stdin = g_memdup (ret, bytesread);
+                       priv->stdin = g_memdup (ret, l + 1);
                }
 
        return ret;