summaryrefslogtreecommitdiff
path: root/lib/ext2fs/finddev.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext2fs/finddev.c')
-rw-r--r--lib/ext2fs/finddev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ext2fs/finddev.c b/lib/ext2fs/finddev.c
index 13ef14bf..311608de 100644
--- a/lib/ext2fs/finddev.c
+++ b/lib/ext2fs/finddev.c
@@ -34,6 +34,7 @@
#include "ext2_fs.h"
#include "ext2fs.h"
+#include "ext2fsP.h"
struct dir_list {
char *name;
@@ -128,6 +129,7 @@ char *ext2fs_find_block_device(dev_t device)
struct dir_list *list = 0, *new_list = 0;
struct dir_list *current;
char *ret_path = 0;
+ int level = 0;
/*
* Add the starting directories to search...
@@ -154,6 +156,9 @@ char *ext2fs_find_block_device(dev_t device)
if (list == 0) {
list = new_list;
new_list = 0;
+ /* Avoid infinite loop */
+ if (++level >= EXT2FS_MAX_NESTED_LINKS)
+ break;
}
}
free_dirlist(&list);