summaryrefslogtreecommitdiffstats
path: root/ip6tables.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2004-10-22 08:14:07 +0000
committerHarald Welte <laforge@gnumonks.org>2004-10-22 08:14:07 +0000
commit10f7f1448314e59d7b536df7e097c5b48f2efd96 (patch)
treec0bb0a7b37ab1518446136e8143862e094ad0686 /ip6tables.c
parent60953f027743af52ba6d3ea4561b5ae169629cd0 (diff)
Fix module-autoloading in certain cases (Fixse Debian Bug 219686)
Diffstat (limited to 'ip6tables.c')
-rw-r--r--ip6tables.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 4b81e782..7cdf4572 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -1595,15 +1595,17 @@ static char *get_modprobe(void)
int procfile;
char *ret;
+#define PROCFILE_BUFSIZ 1024
procfile = open(PROC_SYS_MODPROBE, O_RDONLY);
if (procfile < 0)
return NULL;
- ret = malloc(1024);
+ ret = malloc(PROCFILE_BUFSIZ);
if (ret) {
- switch (read(procfile, ret, 1024)) {
+ memset(ret, 0, PROCFILE_BUFSIZ);
+ switch (read(procfile, ret, PROCFILE_BUFSIZ)) {
case -1: goto fail;
- case 1024: goto fail; /* Partial read. Wierd */
+ case PROCFILE_BUFSIZ: goto fail; /* Partial read. Wierd */
}
if (ret[strlen(ret)-1]=='\n')
ret[strlen(ret)-1]=0;