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

Commit 31f28be9 authored by Shaik Jabida's avatar Shaik Jabida Committed by Vivekananda T
Browse files

dsp: q6lsm: Check size of payload before access



check size of payload before access in q6lsm_mmapcallback.

The payload size can be either 4 or 8 bytes.
Code to verify the payload size is atleast 4 bytes is added.

Change-Id: I595a529829ac4d8743b604f90cb1c742a75b9e7b
Signed-off-by: default avatarShaik Jabida <quic_sjabida@quicinc.com>
(cherry picked from commit 9b8172010c3f6ffbf1e89a6e846f8c715027cfaa)
parent 581a11f3
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2036,7 +2036,13 @@ static int q6lsm_mmapcallback(struct apr_client_data *data, void *priv)
		return 0;
	}

	if (data->payload_size < (2 * sizeof(uint32_t))) {
	/* 
	The payload_size can be either 4 or 8 bytes.
	It has to be verified whether the payload_size is 
	atleast 4 bytes. If it is less, returns errorcode.
	*/

	if (data->payload_size < (2 * sizeof(uint16_t))) {
		pr_err("%s: payload has invalid size[%d]\n", __func__,
			data->payload_size);
		return -EINVAL;