Skip to contentSkip to conversation

ecryptfs: Validate body size

PATCH In review Stephan Müller 1 participant 1 message Jun 26, 2006 Ecrypt file system

lore
Share & tools
lore
#0 lore raw

PATCH 2/6 ecryptfs: Validate body size

Kernel version: 2.6.17-mm1

The patch ensures that body_size is checked for improper values.

---

 fs/ecryptfs/keystore.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

4d78bed2424c6af4a0d1ef4944d485bd5fd48d36

fs/ecryptfs/keystore.c +6 -0
index e80d7a6..9b98fac 100644
@@ -397,6 +397,12 @@ parse_tag_11_packet(unsigned char *data,
 		rc = -EINVAL;
 		goto out;
 	}
+	if (body_size < 13) {
+		ecryptfs_printk(KERN_WARNING, "Invalid body size ([%d])\n",
+				body_size);
+		rc = -EINVAL;
+		goto out;
+	}
 	/* We have 13 bytes of surrounding packet values */
 	(*tag_11_contents_size) = (body_size - 13);
 	if ((*tag_11_contents_size) > max_contents_bytes) {