Skip to content

Commit 15197e7

Browse files
zhuizhuhaomengdoujiang24
authored andcommitted
bugfix: accessed memory out of range when calling lua_pushfstring with none zero-terminated string introduced in commit 7367a23.
1 parent 26809e7 commit 15197e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ngx_http_lua_headers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ ngx_http_lua_ngx_resp_get_headers(lua_State *L)
496496
len = ngx_snprintf(p, NGX_OFF_T_LEN, "%O",
497497
r->headers_out.content_length_n) - p;
498498

499-
lua_pushfstring(L, "%s", (char *) p, len);
499+
lua_pushlstring(L, (char *) p, len);
500500

501501
} else {
502502
lua_pushfstring(L, "%d", (int) r->headers_out.content_length_n);

0 commit comments

Comments
 (0)