Skip to contentSkip to conversation

exportfs: Don't buffer overflow on exports that are too big.

PATCH In review Steve Dickson 1 participant 2 messages Jan 8, 2014 – Jan 20, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exportfs: Don't buffer overflow on exports that are too big.

---
 utils/exportfs/exportfs.c | 2 ++
 1 file changed, 2 insertions(+)
utils/exportfs/exportfs.c +2 -0
index 9ea86cb..8c86790 100644
@@ -452,6 +452,8 @@ static int test_export(char *path, int with_fsid)
 	bp += n;
 	len -= n;
 	qword_add(&bp, &len, path);
+	if (len < 1)
+		return 0;
 	snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0);
 	fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY);
 	if (fd < 0)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line · Steve Dickson

Committed...

steved.

Quoted 18 lines
---
 utils/exportfs/exportfs.c | 2 ++
 1 file changed, 2 insertions(+)
utils/exportfs/exportfs.c +2 -0
index 9ea86cb..8c86790 100644
@@ -452,6 +452,8 @@ static int test_export(char *path, int with_fsid)
 	bp += n;
 	len -= n;
 	qword_add(&bp, &len, path);
+	if (len < 1)
+		return 0;
 	snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0);
 	fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY);
 	if (fd < 0)