add bounds check to prevent memory corruption and integer overflow
This change adds a bounds check to make sure userland can't overflow a kernel stack buffer. In addition the change also prevents an integer overflow from occurring.
This commit is contained in:
parent
02d84e8433
commit
439ac04a65
|
|
@ -412,6 +412,9 @@ int do_vsafecopy(struct proc * caller, message * m_ptr)
|
|||
|
||||
/* No. of vector elements. */
|
||||
els = m_ptr->m_lsys_kern_vsafecopy.vec_size;
|
||||
if (els > SCPVEC_NR) {
|
||||
return EINVAL;
|
||||
}
|
||||
bytes = els * sizeof(struct vscp_vec);
|
||||
|
||||
/* Obtain vector of copies. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user