From: Victor Julien Date: Fri, 17 Aug 2012 15:23:39 +0000 (+0200) Subject: http: after path double decoding, also normalize the path again. #504. X-Git-Tag: suricata-1.3.1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e737e2dc5627ebd49f6697703c578e34da620c43;p=thirdparty%2Fsuricata.git http: after path double decoding, also normalize the path again. #504. --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 9801fe1c8e..6ea25eb0be 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -873,6 +873,18 @@ static int HTPCallbackRequestUriNormalizePath(htp_connp_t *c) if (c->in_tx->parsed_uri->path != NULL) { htp_decode_path_inplace(c->cfg, c->in_tx, c->in_tx->parsed_uri->path); + + /* Handle UTF-8 in path */ + if (c->cfg->path_convert_utf8) { + /* Decode Unicode characters into a single-byte stream, using best-fit mapping */ + htp_utf8_decode_path_inplace(c->cfg, c->in_tx, c->in_tx->parsed_uri->path); + } else { + /* Only validate path as a UTF-8 stream */ + htp_utf8_validate_path(c->in_tx, c->in_tx->parsed_uri->path); + } + + /* normalize after decoding */ + htp_normalize_uri_path_inplace(c->in_tx->parsed_uri->path); } SCReturnInt(HOOK_OK);