Mercurial > hg > nginx-quic
annotate auto/lib/zlib/make @ 8460:3974f4e56a4e
Mail: fixed s->arg_start clearing on invalid IMAP commands.
Previously, s->arg_start was left intact after invalid IMAP commands,
and this might result in an argument incorrectly added to the following
command. Similarly, s->backslash was left intact as well, leading
to unneeded backslash removal.
For example (LFs from the client are explicitly shown as "<LF>"):
S: * OK IMAP4 ready
C: a01 login "\<LF>
S: a01 BAD invalid command
C: a0000000000\2 authenticate <LF>
S: a00000000002 aBAD invalid command
The backslash followed by LF generates invalid command with s->arg_start
and s->backslash set, the following command incorrectly treats anything
from the old s->arg_start to the space after the command as an argument,
and removes the backslash from the tag. If there is no space, s->arg_end
will be NULL.
Both things seem to be harmless though. In particular:
- This can be used to provide an incorrect argument to a command without
arguments. The only command which seems to look at the single argument
is AUTHENTICATE, and it checks the argument length before trying to
access it.
- Backslash removal uses the "end" pointer, and stops due to "src < end"
condition instead of scanning all the process memory if s->arg_end is
NULL (and arg[0].len is huge).
- There should be no backslashes in unquoted strings.
An obvious fix is to clear s->arg_start and s->backslash on invalid commands,
similarly to how it is done in POP3 parsing (added in 810:e3aa8f305d21) and
SMTP parsing.
This, however, makes it clear that s->arg_start handling in the "done"
label is wrong: s->arg_start cannot be legitimately set there, as it
is expected to be cleared in all possible cases when the "done" label is
reached. The relevant code is dead and will be removed by the following
change.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 19 May 2021 03:13:20 +0300 |
parents | 78f8ac479735 |
children |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
320
diff
changeset
|
4 |
274
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
467 | 6 case "$NGX_CC_NAME" in |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
7 |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5360
diff
changeset
|
8 msvc) |
467 | 9 ngx_makefile=makefile.msvc |
503 | 10 ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
11 ngx_zlib="ZLIB=\"$ZLIB\"" |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
12 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
13 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
14 |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5360
diff
changeset
|
15 owc) |
467 | 16 ngx_makefile=makefile.owc |
503 | 17 ngx_opt="CPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
18 ngx_zlib=`echo ZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
19 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
20 |
467 | 21 bcc) |
22 ngx_makefile=makefile.bcc | |
503 | 23 ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
24 ngx_zlib=`echo \-DZLIB=\"$ZLIB\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
274
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 ;; |
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
27 *) |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
28 ngx_makefile= |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
29 ;; |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
30 |
274
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
31 esac |
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
33 |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
34 done=NO |
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
35 |
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
36 |
493 | 37 case "$NGX_PLATFORM" in |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
38 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
39 win32) |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
40 |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
41 if [ -n "$ngx_makefile" ]; then |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
42 cat << END >> $NGX_MAKEFILE |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
43 |
467 | 44 `echo "$ZLIB/zlib.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
45 \$(MAKE) -f auto/lib/zlib/$ngx_makefile $ngx_opt $ngx_zlib |
467 | 46 |
47 END | |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
48 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
49 else |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
50 |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
51 cat << END >> $NGX_MAKEFILE |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
52 |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
53 $ZLIB/libz.a: $NGX_MAKEFILE |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
54 cd $ZLIB \\ |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
55 && \$(MAKE) distclean \\ |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
56 && \$(MAKE) -f win32/Makefile.gcc \\ |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
57 CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\ |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
58 libz.a |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
59 |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
60 END |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
61 |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
62 fi |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
63 |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
64 done=YES |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
65 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
66 |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
67 # FreeBSD: i386 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
68 # Linux: i686 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
69 |
283
8f65fee68270
nginx-0.0.2-2004-03-10-20:55:19 import
Igor Sysoev <igor@sysoev.ru>
parents:
282
diff
changeset
|
70 *:i386 | *:i686) |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
71 case $ZLIB_ASM in |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
72 pentium) |
467 | 73 |
74 cat << END >> $NGX_MAKEFILE | |
75 | |
76 $ZLIB/libz.a: $NGX_MAKEFILE | |
77 cd $ZLIB \\ | |
3476 | 78 && \$(MAKE) distclean \\ |
467 | 79 && cp contrib/asm586/match.S . \\ |
80 && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\ | |
81 ./configure \\ | |
82 && \$(MAKE) OBJA=match.o libz.a | |
83 | |
84 END | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
85 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
86 done=YES |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
87 ;; |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
88 |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
89 pentiumpro) |
467 | 90 |
91 cat << END >> $NGX_MAKEFILE | |
92 | |
93 $ZLIB/libz.a: $NGX_MAKEFILE | |
94 cd $ZLIB \\ | |
3476 | 95 && \$(MAKE) distclean \\ |
467 | 96 && cp contrib/asm686/match.S . \\ |
97 && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\ | |
98 ./configure \\ | |
99 && \$(MAKE) OBJA=match.o libz.a | |
100 | |
101 END | |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
102 |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
103 done=YES |
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
104 ;; |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
105 |
320
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
106 NO) |
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
107 ;; |
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
108 |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
109 *) |
320
d621239c30f7
nginx-0.0.3-2004-04-18-23:06:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
311
diff
changeset
|
110 echo "$0: error: invalid --with-zlib-asm=$ZLIB_ASM option." |
311
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
111 echo "The valid values are \"pentium\" and \"pentiumpro\" only". |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
112 echo |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
113 |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
114 exit 1; |
11ff50a35d6d
nginx-0.0.3-2004-04-12-20:38:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
297
diff
changeset
|
115 ;; |
287
35a6a9df2d25
nginx-0.0.2-2004-03-12-19:57:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
286
diff
changeset
|
116 esac |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
117 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
118 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
119 esac |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
120 |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
121 |
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
122 if [ $done = NO ]; then |
467 | 123 |
124 cat << END >> $NGX_MAKEFILE | |
125 | |
126 $ZLIB/libz.a: $NGX_MAKEFILE | |
127 cd $ZLIB \\ | |
3476 | 128 && \$(MAKE) distclean \\ |
467 | 129 && CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\ |
130 ./configure \\ | |
131 && \$(MAKE) libz.a | |
132 | |
133 END | |
134 | |
286
fc8dc489247e
nginx-0.0.2-2004-03-12-00:34:52 import
Igor Sysoev <igor@sysoev.ru>
parents:
284
diff
changeset
|
135 fi |