mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
drop illegal header values
svn:r370
This commit is contained in:
parent
b15d715cbc
commit
d7918e7963
8
http.c
8
http.c
@ -1115,10 +1115,16 @@ evhttp_remove_header(struct evkeyvalq *headers, const char *key)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (strchr(value, "\r") != NULL || strchr(value, "\n") != NULL) {
|
||||
/* drop illegal headers */
|
||||
return (-1);
|
||||
}
|
||||
|
||||
header = calloc(1, sizeof(struct evkeyval));
|
||||
if (header == NULL) {
|
||||
event_warn("%s: calloc", __func__);
|
||||
|
Loading…
x
Reference in New Issue
Block a user