add a bounds check
This change adds a bounds check to make sure count is not larger than MAX_PARAMS when copying data from the caller. This prevents a buffer overflow from occurring.
This commit is contained in:
parent
12bc3e2937
commit
fc1b542624
|
|
@ -575,7 +575,7 @@ static int do_call(message *m_ptr, int ipc_status, int *code)
|
|||
hgcm_conn[conn].req[req].grant = m_ptr->VBOX_GRANT;
|
||||
hgcm_conn[conn].req[req].count = count;
|
||||
|
||||
if (count > 0) {
|
||||
if (count > 0 && count <= MAX_PARAMS) {
|
||||
if ((r = sys_safecopyfrom(m_ptr->m_source, m_ptr->VBOX_GRANT,
|
||||
0, (vir_bytes) hgcm_conn[conn].req[req].param,
|
||||
count * sizeof(vbox_param_t))) != OK)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user