Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d81e4990 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Check buffer size against command structure size"

parents 49fde6f4 ff8bf37b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -707,7 +707,8 @@ int diag_process_time_sync_query_cmd(unsigned char *src_buf, int src_len,
	struct diag_cmd_time_sync_query_req_t *req = NULL;
	struct diag_cmd_time_sync_query_rsp_t rsp;

	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0) {
	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
		src_len < sizeof(struct diag_cmd_time_sync_query_req_t)) {
		pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d",
			__func__, src_buf, src_len, dest_buf, dest_len);
		return -EINVAL;
@@ -737,7 +738,8 @@ int diag_process_diag_id_query_cmd(unsigned char *src_buf, int src_len,
	int num_entries = 0;
	uint8_t process_name_len = 0;

	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0) {
	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
		src_len < sizeof(struct diag_cmd_diag_id_query_req_t)) {
		pr_err("diag: Invalid input in %s, src_buf:%pK, src_len:%d, dest_buf:%pK, dest_len:%d\n",
			__func__, src_buf, src_len, dest_buf, dest_len);
		return -EINVAL;
@@ -783,7 +785,8 @@ int diag_process_time_sync_switch_cmd(unsigned char *src_buf, int src_len,
	int msg_size = sizeof(struct diag_ctrl_msg_time_sync);
	int err = 0, write_len = 0;

	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0) {
	if (!src_buf || !dest_buf || src_len <= 0 || dest_len <= 0 ||
		src_len < sizeof(struct diag_cmd_time_sync_switch_req_t)) {
		pr_err("diag: Invalid input in %s, src_buf: %pK, src_len: %d, dest_buf: %pK, dest_len: %d",
			__func__, src_buf, src_len, dest_buf, dest_len);
		return -EINVAL;