[patch] exofs: add a cap on the memcpy() size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This data comes from the device, so probably it's fairly trustworthy but
it makes the static checkers happy if we check it.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index d22cd16..755812a 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -529,6 +529,8 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
 			     struct osd_dev_info *odi)
 {
 	odi->systemid_len = le32_to_cpu(dt_dev->systemid_len);
+	if (odi->systemid_len > OSD_SYSTEMID_LEN)
+		return -EINVAL;
 	memcpy(odi->systemid, dt_dev->systemid, odi->systemid_len);
 
 	odi->osdname_len = le32_to_cpu(dt_dev->osdname_len);
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux