Mercurial > hg > nginx-quic
annotate src/core/ngx_config.h @ 4664:356c91151658 stable-1.2
Merge of r4618: rewrite escaping fix (ticket #162).
The following code resulted in incorrect escaping of uri and possible
segfault:
location / {
rewrite ^(.*) $1?c=$1;
return 200 "$uri";
}
If there were arguments in a rewrite's replacement string, and length was
actually calculated (due to duplicate captures as in the example above,
or variables present), the is_args flag was set and incorrectly copied
after length calculation. This resulted in escaping applied to the uri part
of the replacement, resulting in incorrect escaping. Additionally, buffer
was allocated without escaping expected, thus this also resulted in buffer
overrun and possible segfault.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 04 Jun 2012 11:07:19 +0000 |
parents | d620f497c50f |
children | 626f288fa5ed |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
7 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #ifndef _NGX_CONFIG_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 #define _NGX_CONFIG_H_INCLUDED_ |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
455 | 12 #include <ngx_auto_headers.h> |
13 | |
14 | |
323
ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
Igor Sysoev <igor@sysoev.ru>
parents:
316
diff
changeset
|
15 #if defined __DragonFly__ && !defined __FreeBSD__ |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
267
diff
changeset
|
16 #define __FreeBSD__ 4 |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
267
diff
changeset
|
17 #define __FreeBSD_version 480101 |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
267
diff
changeset
|
18 #endif |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
267
diff
changeset
|
19 |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
267
diff
changeset
|
20 |
455 | 21 #if (NGX_FREEBSD) |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
22 #include <ngx_freebsd_config.h> |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
23 |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
24 |
455 | 25 #elif (NGX_LINUX) |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
26 #include <ngx_linux_config.h> |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
27 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 |
455 | 29 #elif (NGX_SOLARIS) |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
30 #include <ngx_solaris_config.h> |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
31 |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
32 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2011
diff
changeset
|
33 #elif (NGX_DARWIN) |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2011
diff
changeset
|
34 #include <ngx_darwin_config.h> |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2011
diff
changeset
|
35 |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2011
diff
changeset
|
36 |
455 | 37 #elif (NGX_WIN32) |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
38 #include <ngx_win32_config.h> |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
39 |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
39
diff
changeset
|
40 |
455 | 41 #else /* POSIX */ |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
346
diff
changeset
|
42 #include <ngx_posix_config.h> |
249
2a0540287298
nginx-0.0.2-2004-02-03-19:43:54 import
Igor Sysoev <igor@sysoev.ru>
parents:
248
diff
changeset
|
43 |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
44 #endif |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
1
diff
changeset
|
45 |
33
b2e039840718
nginx-0.0.1-2002-12-19-20:49:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
46 |
473 | 47 #ifndef NGX_HAVE_SO_SNDLOWAT |
48 #define NGX_HAVE_SO_SNDLOWAT 1 | |
49 #endif | |
50 | |
51 | |
461 | 52 #if !(NGX_WIN32) |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
53 |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
54 #define ngx_signal_helper(n) SIG##n |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
55 #define ngx_signal_value(n) ngx_signal_helper(n) |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
56 |
800 | 57 #define ngx_random random |
58 | |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
59 /* TODO: #ifndef */ |
222
99df0edb63ed
nginx-0.0.1-2004-01-09-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
60 #define NGX_SHUTDOWN_SIGNAL QUIT |
99df0edb63ed
nginx-0.0.1-2004-01-09-00:02:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
218
diff
changeset
|
61 #define NGX_TERMINATE_SIGNAL TERM |
266
5238e93961a1
nginx-0.0.2-2004-02-23-23:57:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
253
diff
changeset
|
62 #define NGX_NOACCEPT_SIGNAL WINCH |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
63 #define NGX_RECONFIGURE_SIGNAL HUP |
382
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
64 |
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
65 #if (NGX_LINUXTHREADS) |
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
66 #define NGX_REOPEN_SIGNAL INFO |
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
67 #define NGX_CHANGEBIN_SIGNAL XCPU |
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
68 #else |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
69 #define NGX_REOPEN_SIGNAL USR1 |
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
70 #define NGX_CHANGEBIN_SIGNAL USR2 |
382
449c4885dcd1
nginx-0.0.7-2004-07-07-23:48:31 import
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
71 #endif |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
72 |
503 | 73 #define ngx_cdecl |
74 #define ngx_libc_cdecl | |
75 | |
116
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
76 #endif |
571bcbff82c5
nginx-0.0.1-2003-07-11-08:50:59 import
Igor Sysoev <igor@sysoev.ru>
parents:
104
diff
changeset
|
77 |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
78 typedef intptr_t ngx_int_t; |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
79 typedef uintptr_t ngx_uint_t; |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
80 typedef intptr_t ngx_flag_t; |
33
b2e039840718
nginx-0.0.1-2002-12-19-20:49:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
29
diff
changeset
|
81 |
356
2e3cbc1bbe3c
nginx-0.0.7-2004-06-16-19:32:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
355
diff
changeset
|
82 |
581 | 83 #define NGX_INT32_LEN sizeof("-2147483648") - 1 |
84 #define NGX_INT64_LEN sizeof("-9223372036854775808") - 1 | |
218
05592fd7a436
nginx-0.0.1-2004-01-05-23:55:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
211
diff
changeset
|
85 |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
86 #if (NGX_PTR_SIZE == 4) |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
87 #define NGX_INT_T_LEN NGX_INT32_LEN |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
88 #else |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
89 #define NGX_INT_T_LEN NGX_INT64_LEN |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
90 #endif |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
91 |
455 | 92 |
581 | 93 #ifndef NGX_ALIGNMENT |
94 #define NGX_ALIGNMENT sizeof(unsigned long) /* platform word */ | |
427
0d08eabe5c7b
nginx-0.0.10-2004-09-15-20:00:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
400
diff
changeset
|
95 #endif |
0d08eabe5c7b
nginx-0.0.10-2004-09-15-20:00:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
400
diff
changeset
|
96 |
589 | 97 #define ngx_align(d, a) (((d) + (a - 1)) & ~(a - 1)) |
605 | 98 #define ngx_align_ptr(p, a) \ |
99 (u_char *) (((uintptr_t) (p) + ((uintptr_t) a - 1)) & ~((uintptr_t) a - 1)) | |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
100 |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
101 |
563 | 102 #define ngx_abort abort |
103 | |
104 | |
1354
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
105 /* TODO: platform specific: array[NGX_INVALID_ARRAY_INDEX] must cause SIGSEGV */ |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
106 #define NGX_INVALID_ARRAY_INDEX 0x80000000 |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
107 |
f69d1aab6a0f
make 64-bit ngx_int_t on 64-bit platforms
Igor Sysoev <igor@sysoev.ru>
parents:
800
diff
changeset
|
108 |
93
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
109 /* TODO: auto_conf: ngx_inline inline __inline __inline__ */ |
738fe44c70d5
nginx-0.0.1-2003-05-21-17:28:21 import
Igor Sysoev <igor@sysoev.ru>
parents:
92
diff
changeset
|
110 #ifndef ngx_inline |
581 | 111 #define ngx_inline inline |
36
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
33
diff
changeset
|
112 #endif |
c14d7232b11f
nginx-0.0.1-2002-12-23-09:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
33
diff
changeset
|
113 |
104
7db96f59bc29
nginx-0.0.1-2003-06-12-09:54:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
114 #ifndef INADDR_NONE /* Solaris */ |
7db96f59bc29
nginx-0.0.1-2003-06-12-09:54:39 import
Igor Sysoev <igor@sysoev.ru>
parents:
94
diff
changeset
|
115 #define INADDR_NONE ((unsigned int) -1) |
59
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
116 #endif |
e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
117 |
2011 | 118 #ifdef MAXHOSTNAMELEN |
119 #define NGX_MAXHOSTNAMELEN MAXHOSTNAMELEN | |
120 #else | |
121 #define NGX_MAXHOSTNAMELEN 256 | |
122 #endif | |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
427
diff
changeset
|
123 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
124 |
471 | 125 #if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8)) |
517 | 126 #define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffffLL |
471 | 127 #else |
517 | 128 #define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffff |
471 | 129 #endif |
130 | |
3962
df2ae4bc7415
fix SSL connection issues on platforms with 32-bit off_t
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
131 #define NGX_MAX_INT32_VALUE (uint32_t) 0x7fffffff |
df2ae4bc7415
fix SSL connection issues on platforms with 32-bit off_t
Igor Sysoev <igor@sysoev.ru>
parents:
2255
diff
changeset
|
132 |
471 | 133 |
0
4eff17414a43
nginx-0.0.1-2002-08-06-20:39:45 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
134 #endif /* _NGX_CONFIG_H_INCLUDED_ */ |