fix: at line 107 of ngx_stream_lua_log_ringbuf in...#403
Closed
orbisai0security wants to merge 1 commit into
Closed
fix: at line 107 of ngx_stream_lua_log_ringbuf in...#403orbisai0security wants to merge 1 commit into
orbisai0security wants to merge 1 commit into
Conversation
Automated security fix generated by Orbis Security AI
Contributor
|
The check is dead code. The only caller ngx_stream_lua_log_ringbuf_write (lines 167–197) already guarantees the bounds before calling append |
Author
|
Thanks for checking. I agree with your analysis: the current call path through ngx_stream_lua_log_ringbuf_write() already enforces n + HEADER_LEN <= rb->size and ensures sufficient free/contiguous space before ngx_stream_lua_log_ringbuf_append() is called, so my added check is redundant in the current code. Also noted that this file is generated from src/subsys/ngx_subsys_lua_log_ringbuf.c.tt2, so any future change should target the template rather than the generated C file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix critical severity security issue in
src/ngx_stream_lua_log_ringbuf.c.Vulnerability
V-001src/ngx_stream_lua_log_ringbuf.c:107Description: At line 107 of ngx_stream_lua_log_ringbuf.c, the function copies n bytes from a caller-supplied buffer into the ring buffer at the tail pointer using ngx_memcpy. There is no validation that n is less than or equal to the remaining capacity of the ring buffer (rb->end - rb->tail). If n exceeds the available space, the copy operation writes beyond the end of the allocated ring buffer, corrupting adjacent heap memory. This can overwrite heap metadata, function pointers, or other critical data structures managed by the nginx allocator.
Changes
src/ngx_stream_lua_log_ringbuf.cVerification
Automated security fix by OrbisAI Security