From 1c78451f0da46b12bbdbd52dfc25ef2eac5c286c Mon Sep 17 00:00:00 2001 From: yuangongji <82787816@qq.com> Date: Mon, 16 Sep 2019 23:24:32 +0800 Subject: [PATCH] http: make sure the other fields in ext_method are not changed by the callback --- http.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/http.c b/http.c index 0fbed957..9d326706 100644 --- a/http.c +++ b/http.c @@ -1998,12 +1998,23 @@ evhttp_parse_request_line(struct evhttp_request *req, char *line, size_t len) ext_method.method = method; ext_method.type = 0; + ext_method.flags = 0; if (req->evcon->ext_method_cmp && req->evcon->ext_method_cmp(&ext_method) == 0) { - /* TODO: make sure the other fields in ext_method are + /* make sure the other fields in ext_method are * not changed by the callback. */ + if (strcmp(ext_method.method, method) != 0) { + event_warn("%s: modifying the 'method' field of ext_method_cmp's " + "parameter is not allowed", __func__); + return -1; + } + if (ext_method.flags != 0) { + event_warn("%s: modifying the 'flags' field of ext_method_cmp's " + "parameter is not allowed", __func__); + return -1; + } type = ext_method.type; } } -- 2.50.1