]> git.kaiwu.me - nginx.git/commitdiff
Improved access log escaping to better protect other software.
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Oct 2011 17:54:38 +0000 (17:54 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 11 Oct 2011 17:54:38 +0000 (17:54 +0000)
Some character sets (notably ISO-8859-1) have C1 control characters in
upper half, make sure to escape them.

Reported by Jesus Olmos Gonzalez.

src/http/modules/ngx_http_log_module.c

index 9728d5411cd48020cb96df33c8b652b47b3e8297..da6fbb619d4005837cecdc27cd9b5cc80b81ae2a 100644 (file)
@@ -690,12 +690,12 @@ ngx_http_log_escape(u_char *dst, u_char *src, size_t size)
         0x10000000, /* 0001 0000 0000 0000  0000 0000 0000 0000 */
 
                     /*  ~}| {zyx wvut srqp  onml kjih gfed cba` */
-        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+        0x80000000, /* 1000 0000 0000 0000  0000 0000 0000 0000 */
 
-        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
-        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
-        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
-        0x00000000, /* 0000 0000 0000 0000  0000 0000 0000 0000 */
+        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
+        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
+        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
+        0xffffffff, /* 1111 1111 1111 1111  1111 1111 1111 1111 */
     };