Skip to content

cmd: check allocation result in NGX_RTMP_SET_STRPAR#1805

Open
DmitryTD wants to merge 1 commit into
arut:masterfrom
DmitryTD:fix-cmd-connect-strpar-null-check
Open

cmd: check allocation result in NGX_RTMP_SET_STRPAR#1805
DmitryTD wants to merge 1 commit into
arut:masterfrom
DmitryTD:fix-cmd-connect-strpar-null-check

Conversation

@DmitryTD

Copy link
Copy Markdown

The NGX_RTMP_SET_STRPAR macro in ngx_rtmp_cmd_connect() copies the connect command string parameters into the connection pool and dereferences the ngx_palloc() result without checking for NULL.

ngx_palloc() can return NULL under memory pressure, which would lead to a NULL pointer dereference and a worker crash.

Add the missing NULL check to the macro, returning NGX_ERROR on allocation failure.

The connect command string parameters (app, args, flashver, ...) were
copied into a pool allocation whose result was not checked for NULL.
Return NGX_ERROR on failure.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Mihalchenko <tascad@altlinux.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant