aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-10-08 08:57:35 +0000
committerEric Andersen <andersen@codepoet.org>2004-10-08 08:57:35 +0000
commita62665b72fa7f956a54de5e173fffcb5a06f8157 (patch)
tree90b98985eef06c5f801d4d5bd977b44683777d35
parentabf58d6ba5df9bbe04c4c7008cbbc8c7dc626392 (diff)
downloadbusybox-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.c6
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
30static const int MS_RDONLY = 1; /* Mount read-only. */ 31static const int MS_RDONLY = 1; /* Mount read-only. */
31 32
32void erase_mtab(const char *name) 33void 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);