summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2004-10-22 08:14:07 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge@netfilter.org>2004-10-22 08:14:07 +0000
commit9d76e33d8bef8dd18da1e4be1d8e128d4da53eea (patch)
treec0bb0a7b37ab1518446136e8143862e094ad0686
parentcb8730c9eaade195048f3dd7fd15de2ac31396bd (diff)
Fix module-autoloading in certain cases (Fixse Debian Bug 219686)
-rw-r--r--ip6tables.c8
-rw-r--r--iptables.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 4b81e78..7cdf457 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;
diff --git a/iptables.c b/iptables.c
index 91e6a9e..12fe316 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1593,15 +1593,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 = (char *) 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;