summaryrefslogtreecommitdiffstats
path: root/utils/exportfs/exportfs.c
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2014-01-17 10:57:29 -0500
committerSteve Dickson <steved@redhat.com>2014-01-20 15:51:46 -0500
commitf4f372ae316a650b4e54c26758af964b5a6d9cbf (patch)
tree4cf024a8037ee5f8a19bc4c0ca810d66d0ab8d85 /utils/exportfs/exportfs.c
parent35640883cf34a32f893e9fecefbb193782e9bc75 (diff)
downloadnfs-utils-f4f372ae316a650b4e54c26758af964b5a6d9cbf.tar.gz
nfs-utils-f4f372ae316a650b4e54c26758af964b5a6d9cbf.tar.xz
nfs-utils-f4f372ae316a650b4e54c26758af964b5a6d9cbf.zip
exportfs: Don't buffer overflow on exports that are too big.
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/exportfs/exportfs.c')
-rw-r--r--utils/exportfs/exportfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 9ea86cb..8c86790 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -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)