# HG changeset patch # User Maxim Dounin # Date 1400694980 -14400 # Node ID d68cd5070f3d7f754e227c1b621f58156655471d # Parent af00bfa9b701b22cc737b01287ccbdb72c1db4bb Mail: added a check for the number of arguments in MAIL/RCPT. Missed during introduction of the SMTP pipelining support (04e43d03e153, 1.5.6). Previously, the check wasn't needed as s->buffer was used directly and the number of arguments didn't matter. Reported by Svyatoslav Nikolsky. diff -r af00bfa9b701 -r d68cd5070f3d src/mail/ngx_mail_smtp_handler.c --- a/src/mail/ngx_mail_smtp_handler.c Tue Aug 05 12:20:22 2014 +0400 +++ b/src/mail/ngx_mail_smtp_handler.c Wed May 21 21:56:20 2014 +0400 @@ -679,6 +679,11 @@ return NGX_OK; } + if (s->args.nelts == 0) { + ngx_str_set(&s->out, smtp_invalid_argument); + return NGX_OK; + } + arg = s->args.elts; arg += s->args.nelts - 1; @@ -713,6 +718,11 @@ return NGX_OK; } + if (s->args.nelts == 0) { + ngx_str_set(&s->out, smtp_invalid_argument); + return NGX_OK; + } + arg = s->args.elts; arg += s->args.nelts - 1;