forked from drath/libratbag
hidpp10/20: fix a buffer overflow
We pass a negative length into log_buffer which expects a size_t. This causes it to write past the allocated output_buf.
This commit is contained in:
@@ -151,7 +151,7 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg)
|
||||
*/
|
||||
read_buffer.msg.device_idx = msg->msg.device_idx;
|
||||
|
||||
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret);
|
||||
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret > 0 ? ret : 0);
|
||||
|
||||
|
||||
/* actual answer */
|
||||
|
||||
@@ -123,7 +123,7 @@ hidpp20_request_command_allow_error(struct ratbag_device *device, union hidpp20_
|
||||
ret = ratbag_hidraw_read_input_report(device, read_buffer.data, LONG_MESSAGE_LENGTH);
|
||||
}
|
||||
|
||||
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret);
|
||||
log_buf_raw(ratbag, " *** received: ", read_buffer.data, ret > 0 ? ret : 0);
|
||||
|
||||
if (read_buffer.msg.report_id != REPORT_ID_SHORT &&
|
||||
read_buffer.msg.report_id != REPORT_ID_LONG)
|
||||
|
||||
Reference in New Issue
Block a user