Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3637955

Browse files
committedMar 19, 2025·
QuickJS: fixed ngx_qjs_string() to handle strings containing "\0".
1 parent 87b569a commit 3637955

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed
 

‎nginx/ngx_js.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1482,13 +1482,11 @@ ngx_qjs_string(JSContext *cx, JSValueConst val, ngx_str_t *dst)
14821482

14831483
string:
14841484

1485-
str = JS_ToCString(cx, val);
1485+
str = JS_ToCStringLen(cx, &len, val);
14861486
if (str == NULL) {
14871487
return NGX_ERROR;
14881488
}
14891489

1490-
len = strlen(str);
1491-
14921490
start = njs_mp_alloc(e->pool, len);
14931491
if (start == NULL) {
14941492
JS_FreeCString(cx, str);

0 commit comments

Comments
 (0)
Please sign in to comment.