OOB fix in set_abort_reason_auxiliary_buffer

passing a message size larger than the size of the msg buffer to
set_abort_reason_auxiliary_buffer() may lead to an out-of-bounds read.
This commit is contained in:
rh0 2024-09-30 21:57:37 +02:00
parent e5e1c4c21f
commit 0533f3f67e

View File

@ -28,6 +28,8 @@ void nyx_abort(const char *fmt, ...)
msglen = vsnprintf(msg, sizeof(msg), fmt, ap); msglen = vsnprintf(msg, sizeof(msg), fmt, ap);
va_end(ap); va_end(ap);
msglen = MIN(msglen, sizeof(msg));
nyx_error("%s\n", msg); nyx_error("%s\n", msg);
set_abort_reason_auxiliary_buffer(GET_GLOBAL_STATE()->auxilary_buffer, msg, set_abort_reason_auxiliary_buffer(GET_GLOBAL_STATE()->auxilary_buffer, msg,
msglen); msglen);