changeset 6163:4e71788460fa

Fixed excessive memory usage while parsing configuration. The b->pos points to the next symbol here. Reported by ilexshen.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 01 Jun 2015 21:08:56 +0300
parents ab78c12412ce
children 4e5dda15f18f
files src/core/ngx_conf_file.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_conf_file.c	Mon Jun 01 16:58:07 2015 +0300
+++ b/src/core/ngx_conf_file.c	Mon Jun 01 21:08:56 2015 +0300
@@ -680,7 +680,7 @@
                     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;
                 }