Don't crash if the sqlite database lacks some values
authorEmilio Pozuelo Monfort <pochu27@gmail.com>
Thu, 22 Oct 2009 14:28:13 +0000 (16:28 +0200)
committerEmilio Pozuelo Monfort <pochu27@gmail.com>
Thu, 22 Oct 2009 14:46:13 +0000 (16:46 +0200)
Right now we strcmp() the isSecure and isHttpOnly values,
but if they are missing we will crash since strcmp() is
not NULL safe. Use g_strcmp0() instead.

libsoup/soup-cookie-jar-sqlite.c

index f782cb3..8114f17 100644 (file)
@@ -207,8 +207,8 @@ callback (void *data, int argc, char **argv, char **colname)
        if (max_age <= 0)
                return 0;
 
-       http_only = (strcmp (argv[COL_HTTP_ONLY], "1") == 0);
-       secure = (strcmp (argv[COL_SECURE], "1") == 0);
+       http_only = (g_strcmp0 (argv[COL_HTTP_ONLY], "1") == 0);
+       secure = (g_strcmp0 (argv[COL_SECURE], "1") == 0);
 
        cookie = soup_cookie_new (name, value, host, path, max_age);