Mercurial > hg > nginx-quic
annotate auto/cc/name @ 4617:972642646f06
Rewrite: fixed escaping and possible segfault (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 | Fri, 11 May 2012 13:19:22 +0000 |
parents | 4871a7dc12a9 |
children | 1f908d2dde8d |
rev | line source |
---|---|
455 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
455 | 4 |
5 | |
946 | 6 if [ "$NGX_PLATFORM" != win32 ]; then |
7 | |
8 ngx_feature="C compiler" | |
9 ngx_feature_name= | |
10 ngx_feature_run=yes | |
11 ngx_feature_incs= | |
12 ngx_feature_path= | |
13 ngx_feature_libs= | |
14 ngx_feature_test= | |
15 . auto/feature | |
16 | |
17 if [ $ngx_found = no ]; then | |
18 echo | |
19 echo $0: error: C compiler $CC is not found | |
20 echo | |
21 exit 1 | |
22 fi | |
23 | |
24 fi | |
455 | 25 |
26 | |
577 | 27 if [ "$CC" = cl ]; then |
461 | 28 if `$NGX_WINE $CC -v 2>&1 \ |
4229
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
29 | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16' \ |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
30 >/dev/null 2>&1`; then |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
31 |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
32 NGX_CC_NAME=msvc10 |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
33 echo " + using Microsoft Visual C++ 10 compiler" |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
34 |
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
35 else if `$NGX_WINE $CC -v 2>&1 \ |
1639
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
36 | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14' \ |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
37 >/dev/null 2>&1`; then |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
38 |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
39 NGX_CC_NAME=msvc8 |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
40 echo " + using Microsoft Visual C++ 8 compiler" |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
41 |
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
42 else if `$NGX_WINE $CC -v 2>&1 \ |
461 | 43 | grep '^Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13' \ |
703 | 44 >/dev/null 2>&1`; then |
461 | 45 |
46 NGX_CC_NAME=msvc7 | |
946 | 47 echo " + using Microsoft Visual C++ 7 compiler" |
461 | 48 |
49 else | |
50 NGX_CC_NAME=msvc | |
946 | 51 echo " + using Microsoft Visual C++ compiler" |
461 | 52 fi |
1639
7d125a707158
msvc8 compatibility: it can not build with debug under Wine
Igor Sysoev <igor@sysoev.ru>
parents:
946
diff
changeset
|
53 fi |
4229
fbd6d1e5cdef
Fix of building by Microsoft Visual C++ 10 compiler.
Igor Sysoev <igor@sysoev.ru>
parents:
1639
diff
changeset
|
54 fi |
455 | 55 |
56 else | |
577 | 57 if [ "$CC" = wcl386 ]; then |
455 | 58 NGX_CC_NAME=owc |
946 | 59 echo " + using Open Watcom C compiler" |
455 | 60 |
61 else | |
577 | 62 if [ "$CC" = bcc32 ]; then |
455 | 63 NGX_CC_NAME=bcc |
946 | 64 echo " + using Borland C++ compiler" |
455 | 65 |
66 else | |
4492
4871a7dc12a9
Configure: moved icc detection before gcc.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
67 if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then |
4871a7dc12a9
Configure: moved icc detection before gcc.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
68 NGX_CC_NAME=icc |
4871a7dc12a9
Configure: moved icc detection before gcc.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
69 echo " + using Intel C++ compiler" |
4871a7dc12a9
Configure: moved icc detection before gcc.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
70 |
4871a7dc12a9
Configure: moved icc detection before gcc.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
71 else |
703 | 72 if `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then |
455 | 73 NGX_CC_NAME=gcc |
946 | 74 echo " + using GNU C compiler" |
455 | 75 |
76 else | |
703 | 77 if `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then |
561 | 78 NGX_CC_NAME=sunc |
946 | 79 echo " + using Sun C compiler" |
561 | 80 |
81 else | |
703 | 82 if `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then |
455 | 83 NGX_CC_NAME=ccc |
946 | 84 echo " + using Compaq C compiler" |
455 | 85 |
86 else | |
703 | 87 if `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then |
455 | 88 NGX_CC_NAME=acc |
946 | 89 echo " + using HP aC++ compiler" |
455 | 90 |
91 else | |
517 | 92 NGX_CC_NAME=unknown |
455 | 93 |
94 fi # acc | |
95 fi # ccc | |
561 | 96 fi # sunc |
455 | 97 fi # icc |
98 fi # gcc | |
99 fi # bcc | |
100 fi # owc | |
101 fi # msvc |