diff options
Diffstat (limited to 'iptables.c')
-rw-r--r-- | iptables.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; |