Previously, heap-use-after-free might occur when HTTP Response was
received with more than 8 headers and headers iteration is used.
The fix is not to assume that pointer to the beginning of the keys array
never changes. The pointer may change when array is resized.
The issue was introduced in
81040de6b085 (0.5.1).
This closes #492 issue on Github.
length = 0;
headers = http->headers.elts;
- start = njs_vm_array_start(vm, keys);
for (i = 0; i < http->headers.nelts; i++) {
h = &headers[i];
+ start = njs_vm_array_start(vm, keys);
for (k = 0; k < length; k++) {
njs_value_string_get(njs_argument(start, k), &hdr);