From 6dd00c0e663ec4c9127ac7f6a1aa2509d0aeb667 Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Fri, 19 Feb 2010 14:40:22 +0100 Subject: [PATCH] Fix potential segfault if requesturi == NULL --- cgi/cblog_cgi.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/cgi/cblog_cgi.c b/cgi/cblog_cgi.c index 11afd76..abe159d 100644 --- a/cgi/cblog_cgi.c +++ b/cgi/cblog_cgi.c @@ -364,10 +364,11 @@ cblogcgi(HDF *conf) hdf_set_valuef(cgi->hdf, "CBlog.url=%s", cblog_url); requesturi = get_cgi_str(cgi->hdf, "RequestURI"); - splitchr(requesturi, '?'); /* find the beginig of the request */ if (requesturi != NULL) + { + splitchr(requesturi, '?'); if (requesturi[1] != '\0') { for (i = 0; page[i].name != NULL; i++) { if (STARTS_WITH(requesturi, page[i].name)) { @@ -378,6 +379,7 @@ cblogcgi(HDF *conf) if (type == CBLOG_ROOT) hdf_set_valuef(cgi->hdf, "err_msg=Unknown request: %s", requesturi); } + } switch (type) { case CBLOG_POST: -- 1.6.6.1