Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net.c: properly check result of vsnprintf() in 'send_remote_command()' #134

Merged
merged 2 commits into from
May 6, 2024

Conversation

lxv
Copy link
Contributor

@lxv lxv commented May 5, 2024

An excessively long remote command may get truncated by 'vsnprintf()' call in L87 which may go unnoticed by the incorrect check in L89 resulting in two bytes written beyond 'char cmd[4096]' array with 'strcat()' in L95 that assumes enough space was left in the buffer to append "\r\n"

An excessively long remote command may get truncated by 'vsnprintf()'
call in L87 which may go unnoticed by the incorrect check in L89
resulting in two bytes written beyond 'char cmd[4096]' array with
'strcat()' in L95 that assumes enough space was left in the buffer
to append "\r\n"

Includes <setjmp.h> and <signal.h> are not used in this file - removed;
missing '#include <stdarg.h>' (needed for va_start/va_end()) and
'#include <stdio.h>' (needed for vsnprintf()) added.
@corecode
Copy link
Owner

corecode commented May 6, 2024 via email

@corecode corecode merged commit ffad280 into corecode:master May 6, 2024
@lxv lxv deleted the vsnprintf-result-check branch May 6, 2024 23:11
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.

None yet

2 participants