[netfilter-cvslog] r3251 - trunk/iptables

/C=DE/ST=Berlin/L=Berlin/O=Netfilter /C=DE/ST=Berlin/L=Berlin/O=Netfilter
Fri Oct 22 10:14:09 CEST 2004


Author: /C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=laforge/emailAddress=laforge at netfilter.org
Date: 2004-10-22 10:14:07 +0200 (Fri, 22 Oct 2004)
New Revision: 3251

Modified:
   trunk/iptables/ip6tables.c
   trunk/iptables/iptables.c
Log:
Fix module-autoloading in certain cases (Fixse Debian Bug 219686)


Modified: trunk/iptables/ip6tables.c
===================================================================
--- trunk/iptables/ip6tables.c	2004-10-21 20:28:54 UTC (rev 3250)
+++ trunk/iptables/ip6tables.c	2004-10-22 08:14:07 UTC (rev 3251)
@@ -1595,15 +1595,17 @@
 	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;

Modified: trunk/iptables/iptables.c
===================================================================
--- trunk/iptables/iptables.c	2004-10-21 20:28:54 UTC (rev 3250)
+++ trunk/iptables/iptables.c	2004-10-22 08:14:07 UTC (rev 3251)
@@ -1593,15 +1593,17 @@
 	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;




More information about the netfilter-cvslog mailing list