disp: msm: add check for buffer length before copy
Length of the buffer to be copied is checked against both source and destination buffer lengths before copying. This ensures that there is no buffer overflow while reading as well as writing. Change-Id: I4bd1a5892b47771aef4c23a4d1594fc1c8361577 Signed-off-by: Satya Rama Aditya Pinapala <psraditya30@codeaurora.org>
Šī revīzija ir iekļauta:
@@ -1731,7 +1731,10 @@ static ssize_t _sde_debugfs_conn_cmd_tx_sts_read(struct file *file,
|
||||
return 0;
|
||||
}
|
||||
|
||||
blen = min_t(size_t, MAX_CMD_PAYLOAD_SIZE, count);
|
||||
if (blen > count)
|
||||
blen = count;
|
||||
|
||||
blen = min_t(size_t, blen, MAX_CMD_PAYLOAD_SIZE);
|
||||
if (copy_to_user(buf, buffer, blen)) {
|
||||
SDE_ERROR("copy to user buffer failed\n");
|
||||
return -EFAULT;
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user