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

Commit 93ae6efa authored by Min Chong's avatar Min Chong Committed by Gerrit - the friendly Code Review server
Browse files

input: synaptics_dsx: add checks of user input data



Add checks of the user input count to avoid possible heap overflow

Signed-off-by: default avatarMin Chong <mchong@google.com>
Bug: 30937462
Git-repo: https://android.googlesource.com/kernel/msm.git


Git-commit: a6accafb252a76256f11c83e28c556c8ca4b8e1f
Change-Id: I6fc8323cbcf395a2c24e49e65cc7012709d031a2
Signed-off-by: default avatarDennis Cagle <d-cagle@codeaurora.org>
parent 9febdfdd
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1606,6 +1606,13 @@ static ssize_t fwu_sysfs_store_image(struct file *data_file,
		struct kobject *kobj, struct bin_attribute *attributes,
		char *buf, loff_t pos, size_t count)
{
	if (count > (fwu->image_size - fwu->data_pos)) {
		dev_err(fwu->rmi4_data->pdev->dev.parent,
				"%s: Not enough space in buffer\n",
				__func__);
		return -EINVAL;
	}

	memcpy((void *)(&fwu->ext_data_source[fwu->data_pos]),
			(const void *)buf,
			count);