]> git.kaiwu.me - nginx.git/commitdiff
Mail: optimized discarding invalid SMTP commands.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 19 May 2021 00:13:17 +0000 (03:13 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 19 May 2021 00:13:17 +0000 (03:13 +0300)
There is no need to scan buffer from s->buffer->pos, as we already scanned
the buffer till "p" and wasn't able to find an LF.

There is no real need for this change in SMTP, since it is at most a
microoptimization of a non-common code path.  Similar code in IMAP, however,
will have to start scanning from "p" to be correct, since there can be
newlines in IMAP literals.

src/mail/ngx_mail_parse.c

index 0712ad5dc49530f9fd6de38aa9a2152b2d8e7e60..c4e8f0eaedc333ed6308536d580d3499c36d0dfe 100644 (file)
@@ -843,7 +843,7 @@ invalid:
 
     /* skip invalid command till LF */
 
-    for (p = s->buffer->pos; p < s->buffer->last; p++) {
+    for ( /* void */ ; p < s->buffer->last; p++) {
         if (*p == LF) {
             s->state = sw_start;
             s->buffer->pos = p + 1;