From f12d6ceb65626b633cd950b06185d125246d96d9 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 25 Oct 2011 13:48:43 +0000 Subject: [PATCH] Fixed port range checking. --- src/core/ngx_inet.c | 6 +++--- src/mail/ngx_mail_auth_http_module.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c index ac1ca8bf2..4baa74aee 100644 --- a/src/core/ngx_inet.c +++ b/src/core/ngx_inet.c @@ -671,7 +671,7 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u) n = ngx_atoi(port, len); - if (n < 1 || n > 65536) { + if (n < 1 || n > 65535) { u->err = "invalid port"; return NGX_ERROR; } @@ -695,7 +695,7 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u) if (n != NGX_ERROR) { - if (n < 1 || n > 65536) { + if (n < 1 || n > 65535) { u->err = "invalid port"; return NGX_ERROR; } @@ -835,7 +835,7 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u) n = ngx_atoi(port, len); - if (n < 1 || n > 65536) { + if (n < 1 || n > 65535) { u->err = "invalid port"; return NGX_ERROR; } diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c index d54a392ac..c82332690 100644 --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -783,7 +783,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s, sin->sin_family = AF_INET; port = ngx_atoi(ctx->port.data, ctx->port.len); - if (port == NGX_ERROR || port < 1 || port > 65536) { + if (port == NGX_ERROR || port < 1 || port > 65535) { ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "auth http server %V sent invalid server " "port:\"%V\"",