From 18edcf5a40573898785b6a41a38338143e94744c Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Wed, 27 Jun 2007 15:35:30 +0000 Subject: Move the p->parent check in urldb to before the cookie loop. Prevents the cookie stuff exploding on domain cookies with no path. Fixes breakage with visiting launchpad.net svn path=/trunk/netsurf/; revision=3368 --- content/urldb.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/content/urldb.c b/content/urldb.c index 27ae61aaa..4d4bc3fb2 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -2460,6 +2460,18 @@ char *urldb_get_cookie(const char *url) } } + if (!p->parent) { + /* No parent, so bail here. This can't go in + * the loop exit condition as we also want to + * process the top-level node. + * + * If p->parent is NULL then p->cookies are + * the domain cookies and thus we don't even + * try matching against them. + */ + break; + } + /* Consider p itself - may be the result of Path=/foo */ for (c = p->cookies; c; c = c->next) { if (c->expires != 1 && c->expires < now) @@ -2491,12 +2503,6 @@ char *urldb_get_cookie(const char *url) count++; } - if (!p->parent) { - /* No parent, so bail here. This can't go in the - * loop exit condition as we want to process the - * top-level node, too */ - break; - } } // LOG(("%s", ret)); -- cgit v1.2.3