]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Fix module-autoloading in certain cases (Fixse Debian Bug 219686)
authorHarald Welte <laforge@gnumonks.org>
Fri, 22 Oct 2004 08:14:07 +0000 (08:14 +0000)
committerHarald Welte <laforge@gnumonks.org>
Fri, 22 Oct 2004 08:14:07 +0000 (08:14 +0000)
ip6tables.c
iptables.c

index 4b81e78283f0097d8f550fe0d7caf9568a4ff8af..7cdf457279b60c67bf18d9657d5ec59fad1a8239 100644 (file)
@@ -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;
index 91e6a9e694223956e337ea01aae18cbe3630b2e8..12fe316d1a30c5c7c6552f4c5a051763f320a732 100644 (file)
@@ -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;