From: Timo Sirainen Date: Mon, 22 Feb 2016 18:00:13 +0000 (+0200) Subject: doveadm-http: Return HTTP failure on unexpected JSON input X-Git-Tag: 2.2.22.rc1~106 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=346ce9e82d31012b8640cad6369e66417ca8c782;p=thirdparty%2Fdovecot%2Fcore.git doveadm-http: Return HTTP failure on unexpected JSON input --- diff --git a/src/doveadm/client-connection-http.c b/src/doveadm/client-connection-http.c index 6fcf21a7a5..3788d7a679 100644 --- a/src/doveadm/client-connection-http.c +++ b/src/doveadm/client-connection-http.c @@ -462,7 +462,7 @@ doveadm_http_server_read_request(struct client_connection_http *conn) if (!conn->client.input->eof && rc == 0) return; - if ((rc == 1 && conn->json_state != JSON_STATE_DONE)) { + if (rc == -2 || (rc == 1 && conn->json_state != JSON_STATE_DONE)) { /* this will happen if the parser above runs into unexpected element, but JSON is OK */ http_server_request_fail_close(conn->http_server_request, 400, "Unexpected element in input"); // FIXME: should be returned as error to client, not logged