drop illegal header values

svn:r370
This commit is contained in:
Niels Provos 2007-07-30 21:27:33 +00:00
parent b15d715cbc
commit d7918e7963

8
http.c
View File

@ -1115,10 +1115,16 @@ evhttp_remove_header(struct evkeyvalq *headers, const char *key)
} }
int int
evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value) evhttp_add_header(struct evkeyvalq *headers,
const char *key, const char *value)
{ {
struct evkeyval *header; struct evkeyval *header;
if (strchr(value, "\r") != NULL || strchr(value, "\n") != NULL) {
/* drop illegal headers */
return (-1);
}
header = calloc(1, sizeof(struct evkeyval)); header = calloc(1, sizeof(struct evkeyval));
if (header == NULL) { if (header == NULL) {
event_warn("%s: calloc", __func__); event_warn("%s: calloc", __func__);