summaryrefslogtreecommitdiffstats
path: root/usr.sbin/mountd/mountd.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/mountd/mountd.c')
-rw-r--r--usr.sbin/mountd/mountd.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 3061d2f..b219c76 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -54,6 +54,8 @@ static const char rcsid[] =
#include <sys/stat.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
+#include <sys/linker.h>
+#include <sys/module.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
@@ -268,7 +270,7 @@ main(argc, argv)
int udpsock, tcpsock, udp6sock, tcp6sock;
int xcreated = 0, s;
int one = 1;
- int c, error;
+ int c;
udp6conf = tcp6conf = NULL;
udp6sock = tcp6sock = NULL;
@@ -874,8 +876,8 @@ put_exlist(dp, xdrsp, adp, putdefp)
return (0);
}
-#define LINESIZ 10240
-char line[LINESIZ];
+char *line;
+int linesize;
FILE *exp_file;
/*
@@ -1997,7 +1999,7 @@ int
get_line()
{
char *p, *cp;
- int len;
+ size_t len;
int totlen, cont_line;
/*
@@ -2006,9 +2008,8 @@ get_line()
p = line;
totlen = 0;
do {
- if (fgets(p, LINESIZ - totlen, exp_file) == NULL)
+ if ((p = fgetln(exp_file, &len)) == NULL)
return (0);
- len = strlen(p);
cp = p + len - 1;
cont_line = 0;
while (cp >= p &&
@@ -2022,15 +2023,15 @@ get_line()
*++cp = ' ';
len++;
}
- *++cp = '\0';
- if (len > 0) {
- totlen += len;
- if (totlen >= LINESIZ) {
- syslog(LOG_ERR, "exports line too long");
- exit(2);
- }
- p = cp;
+ if (linesize < len + totlen + 1) {
+ linesize = len + totlen + 1;
+ line = realloc(line, linesize);
+ if (line == NULL)
+ out_of_mem();
}
+ memcpy(line + totlen, p, len);
+ totlen += len;
+ line[totlen] = '\0';
} while (totlen == 0 || cont_line);
return (1);
}
OpenPOWER on IntegriCloud