From: Niels Provos Date: Mon, 6 Aug 2007 20:53:33 +0000 (+0000) Subject: fix an embarassing bug where strchr was used with a cstring instead of a char X-Git-Tag: release-2.0.1-alpha~601 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=073d35906117ce1276b16cdfc70d744deb04575d;p=libevent fix an embarassing bug where strchr was used with a cstring instead of a char svn:r383 --- diff --git a/http.c b/http.c index 699fd98b..2ecf7bdc 100644 --- a/http.c +++ b/http.c @@ -1120,10 +1120,13 @@ int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value) { - struct evkeyval *header; + struct evkeyval *header = NULL; + + event_debug(("%s: key: %s val: %s\n", __func__, key, value)); - if (strchr(value, "\r") != NULL || strchr(value, "\n") != NULL) { + if (strchr(value, '\r') != NULL || strchr(value, '\n') != NULL) { /* drop illegal headers */ + event_debug(("%s: dropping illegal header\n")); return (-1); } diff --git a/test/regress_http.c b/test/regress_http.c index 5c6714c6..2553ada9 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -517,6 +517,11 @@ http_postrequest_done(struct evhttp_request *req, void *arg) { const char *what = "This is funny"; + if (req == NULL) { + fprintf(stderr, "FAILED (timeout)\n"); + exit(1); + } + if (req->response_code != HTTP_OK) { fprintf(stderr, "FAILED (response code)\n");