]> git.kaiwu.me - nginx.git/commitdiff
Fixed excessive memory usage while parsing configuration.
authorValentin Bartenev <vbart@nginx.com>
Mon, 1 Jun 2015 18:08:56 +0000 (21:08 +0300)
committerValentin Bartenev <vbart@nginx.com>
Mon, 1 Jun 2015 18:08:56 +0000 (21:08 +0300)
The b->pos points to the next symbol here.

Reported by ilexshen.

src/core/ngx_conf_file.c

index ec3c1fae1d94a4aea7b108f7af5720295d40fa41..8273a7fcd8748f90af3e6f0f8d23a853d95602ba 100644 (file)
@@ -680,7 +680,7 @@ ngx_conf_read_token(ngx_conf_t *cf)
                     return NGX_ERROR;
                 }
 
-                word->data = ngx_pnalloc(cf->pool, b->pos - start + 1);
+                word->data = ngx_pnalloc(cf->pool, b->pos - 1 - start + 1);
                 if (word->data == NULL) {
                     return NGX_ERROR;
                 }