[njs] Fixed Headers object keys forgotten in 81040de6b085.

Dmitry Volyntsev xeioex at nginx.com
Tue Jan 26 12:53:01 UTC 2021


details:   https://hg.nginx.org/njs/rev/63147f56e418
branches:  
changeset: 1596:63147f56e418
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Jan 26 12:52:17 2021 +0000
description:
Fixed Headers object keys forgotten in 81040de6b085.

Found by Coverity (CID 1472501).

diffstat:

 nginx/ngx_js_fetch.c |  14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r 60d363cb92b3 -r 63147f56e418 nginx/ngx_js_fetch.c
--- a/nginx/ngx_js_fetch.c	Tue Jan 26 12:52:15 2021 +0000
+++ b/nginx/ngx_js_fetch.c	Tue Jan 26 12:52:17 2021 +0000
@@ -2035,6 +2035,20 @@ ngx_response_js_ext_keys(njs_vm_t *vm, n
                 break;
             }
         }
+
+        if (k == length) {
+            value = njs_vm_array_push(vm, keys);
+            if (value == NULL) {
+                return NJS_ERROR;
+            }
+
+            rc = njs_vm_value_string_set(vm, value, h->key.data, h->key.len);
+            if (rc != NJS_OK) {
+                return NJS_ERROR;
+            }
+
+            length++;
+        }
     }
 
     return NJS_OK;


More information about the nginx-devel mailing list