aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-10-08 08:57:35 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2004-10-08 08:57:35 +0000
commit90601801ab7b3762a3954fd1580e59451598e906 (patch)
tree90b98985eef06c5f801d4d5bd977b44683777d35
parent567afa14553e9e80716e3f238530afdcf0a22229 (diff)
downloadbusybox-w32-90601801ab7b3762a3954fd1580e59451598e906.tar.gz
busybox-w32-90601801ab7b3762a3954fd1580e59451598e906.tar.bz2
busybox-w32-90601801ab7b3762a3954fd1580e59451598e906.zip
Patch from Claus Klein to increase, and make more apparent
the hard coded limit on the number of mounts git-svn-id: svn://busybox.net/trunk/busybox@9330 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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);