Klaus Demo nginx / 6692bd2
Merge of r4227, r4228: Fixed range checking for the "somaxconn" sysctl. Fixed port range checking. Maxim Dounin 10 years ago
4 changed file(s) with 9 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
670670
671671 n = ngx_atoi(port, len);
672672
673 if (n < 1 || n > 65536) {
673 if (n < 1 || n > 65535) {
674674 u->err = "invalid port";
675675 return NGX_ERROR;
676676 }
694694
695695 if (n != NGX_ERROR) {
696696
697 if (n < 1 || n > 65536) {
697 if (n < 1 || n > 65535) {
698698 u->err = "invalid port";
699699 return NGX_ERROR;
700700 }
834834
835835 n = ngx_atoi(port, len);
836836
837 if (n < 1 || n > 65536) {
837 if (n < 1 || n > 65535) {
838838 u->err = "invalid port";
839839 return NGX_ERROR;
840840 }
782782 sin->sin_family = AF_INET;
783783
784784 port = ngx_atoi(ctx->port.data, ctx->port.len);
785 if (port == NGX_ERROR || port < 1 || port > 65536) {
785 if (port == NGX_ERROR || port < 1 || port > 65535) {
786786 ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
787787 "auth http server %V sent invalid server "
788788 "port:\"%V\"",
5757 ngx_int_t
5858 ngx_os_specific_init(ngx_log_t *log)
5959 {
60 int somaxconn;
6160 size_t size;
6261 ngx_err_t err;
6362 ngx_uint_t i;
124123
125124 ngx_ncpu = ngx_darwin_hw_ncpu;
126125
127 somaxconn = 32676;
128
129 if (ngx_darwin_kern_ipc_somaxconn > somaxconn) {
126 if (ngx_darwin_kern_ipc_somaxconn > 32767) {
130127 ngx_log_error(NGX_LOG_ALERT, log, 0,
131 "sysctl kern.ipc.somaxconn must be no more than %d",
132 somaxconn);
128 "sysctl kern.ipc.somaxconn must be less than 32768");
133129 return NGX_ERROR;
134130 }
135131
9696 ngx_int_t
9797 ngx_os_specific_init(ngx_log_t *log)
9898 {
99 int version, somaxconn;
99 int version;
100100 size_t size;
101101 ngx_err_t err;
102102 ngx_uint_t i;
208208 ngx_ncpu = ngx_freebsd_hw_ncpu;
209209 }
210210
211 somaxconn = version < 600008 ? 32676 : 65535;
212
213 if (ngx_freebsd_kern_ipc_somaxconn > somaxconn) {
211 if (version < 600008 && ngx_freebsd_kern_ipc_somaxconn > 32767) {
214212 ngx_log_error(NGX_LOG_ALERT, log, 0,
215 "sysctl kern.ipc.somaxconn must be no more than %d",
216 somaxconn);
213 "sysctl kern.ipc.somaxconn must be less than 32768");
217214 return NGX_ERROR;
218215 }
219216