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-w32-a62665b72fa7f956a54de5e173fffcb5a06f8157.tar.gz busybox-w32-a62665b72fa7f956a54de5e173fffcb5a06f8157.tar.bz2 busybox-w32-a62665b72fa7f956a54de5e173fffcb5a06f8157.zip |
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 @@ | |||
27 | #include <mntent.h> | 27 | #include <mntent.h> |
28 | #include "libbb.h" | 28 | #include "libbb.h" |
29 | 29 | ||
30 | #define MTAB_MAX_ENTRIES 40 | ||
30 | static const int MS_RDONLY = 1; /* Mount read-only. */ | 31 | static const int MS_RDONLY = 1; /* Mount read-only. */ |
31 | 32 | ||
32 | void erase_mtab(const char *name) | 33 | void erase_mtab(const char *name) |
33 | { | 34 | { |
34 | struct mntent entries[20]; | 35 | struct mntent entries[MTAB_MAX_ENTRIES]; |
35 | int count = 0; | 36 | int count = 0; |
36 | FILE *mountTable = setmntent(bb_path_mtab_file, "r"); | 37 | FILE *mountTable = setmntent(bb_path_mtab_file, "r"); |
37 | struct mntent *m; | 38 | struct mntent *m; |
@@ -44,7 +45,8 @@ void erase_mtab(const char *name) | |||
44 | return; | 45 | return; |
45 | } | 46 | } |
46 | 47 | ||
47 | while ((m = getmntent(mountTable)) != 0) { | 48 | while (((m = getmntent(mountTable)) != 0) && (count < MTAB_MAX_ENTRIES)) |
49 | { | ||
48 | entries[count].mnt_fsname = strdup(m->mnt_fsname); | 50 | entries[count].mnt_fsname = strdup(m->mnt_fsname); |
49 | entries[count].mnt_dir = strdup(m->mnt_dir); | 51 | entries[count].mnt_dir = strdup(m->mnt_dir); |
50 | entries[count].mnt_type = strdup(m->mnt_type); | 52 | entries[count].mnt_type = strdup(m->mnt_type); |