[PATCH 1/2] nfs4-acl-tools: Fix segfault if format of the input file is incorrect

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

 



The sizeof operator, when applied to a parameter declared to have array,
yields the size of the adjusted (pointer) type, even if the parameter
declaration specifies a length.

Signed-off-by: Malahal Naineni <malahal@xxxxxxxxxx>
---
 libnfs4acl/nfs4_ace_from_string.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libnfs4acl/nfs4_ace_from_string.c b/libnfs4acl/nfs4_ace_from_string.c
index 9d877fb..462fcc0 100644
--- a/libnfs4acl/nfs4_ace_from_string.c
+++ b/libnfs4acl/nfs4_ace_from_string.c
@@ -100,7 +100,7 @@ parse_alloc_fields(char *buf, char *fields[NUMFIELDS])
 	if (!buf)
 		return -EINVAL;
 
-	memset(fields, 0, sizeof(fields));
+	memset(fields, 0, sizeof(char *) * NUMFIELDS);
 
 	for (i = 0; buf[i] != '\0'; i++) {
 		if (buf[i] == ':')
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux