Maxim Dounin
May 18, 2021 09:28PM
details: https://hg.nginx.org/nginx/rev/ba8a8299b904
branches:
changeset: 7837:ba8a8299b904
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed May 19 03:13:17 2021 +0300
description:
Mail: optimized discarding invalid SMTP commands.

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.

diffstat:

src/mail/ngx_mail_parse.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 6a81d96d3733 -r ba8a8299b904 src/mail/ngx_mail_parse.c
--- a/src/mail/ngx_mail_parse.c Wed May 19 03:13:15 2021 +0300
+++ b/src/mail/ngx_mail_parse.c Wed May 19 03:13:17 2021 +0300
@@ -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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Mail: optimized discarding invalid SMTP commands.

Maxim Dounin 193 May 18, 2021 09:28PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 179
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready