diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-10-08 08:57:35 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-10-08 08:57:35 +0000 |
commit | a62665b72fa7f956a54de5e173fffcb5a06f8157 (patch) | |
tree | 90b98985eef06c5f801d4d5bd977b44683777d35 | |
parent | abf58d6ba5df9bbe04c4c7008cbbc8c7dc626392 (diff) | |
download | busybox-a62665b72fa7f956a54de5e173fffcb5a06f8157.tar.gz |
Patch from Claus Klein to increase, and make more apparent
the hard coded limit on the number of mounts
-rw-r--r-- | libbb/mtab.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libbb/mtab.c b/libbb/mtab.c index 528422567..b1f74c476 100644 --- a/libbb/mtab.c +++ b/libbb/mtab.c @@ -27,11 +27,12 @@ #include <mntent.h> #include "libbb.h" +#define MTAB_MAX_ENTRIES 40 static const int MS_RDONLY = 1; /* Mount read-only. */ void erase_mtab(const char *name) { - struct mntent entries[20]; + struct mntent entries[MTAB_MAX_ENTRIES]; int count = 0; FILE *mountTable = setmntent(bb_path_mtab_file, "r"); struct mntent *m; @@ -44,7 +45,8 @@ void erase_mtab(const char *name) return; } - while ((m = getmntent(mountTable)) != 0) { + while (((m = getmntent(mountTable)) != 0) && (count < MTAB_MAX_ENTRIES)) + { entries[count].mnt_fsname = strdup(m->mnt_fsname); entries[count].mnt_dir = strdup(m->mnt_dir); entries[count].mnt_type = strdup(m->mnt_type); |