]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: after path double decoding, also normalize the path again. #504.
authorVictor Julien <victor@inliniac.net>
Fri, 17 Aug 2012 15:23:39 +0000 (17:23 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 17 Aug 2012 15:23:39 +0000 (17:23 +0200)
src/app-layer-htp.c

index 9801fe1c8e4dc367d7388967d9aa8e3e1e83aabc..6ea25eb0bebb16d1243f4016f99c5859db52b8f0 100644 (file)
@@ -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);