ls: check for the index size before using it in visit()
Thanks to k0ga for noticing it!
This commit is contained in:
parent
1024369f2d
commit
ee8701d501
2
ls.c
2
ls.c
@ -311,7 +311,7 @@ visit(const struct entry *ent)
|
|||||||
dev = ent->dev;
|
dev = ent->dev;
|
||||||
ino = S_ISLNK(ent->mode) ? ent->tino : ent->ino;
|
ino = S_ISLNK(ent->mode) ? ent->tino : ent->ino;
|
||||||
|
|
||||||
for (i = 0; tree[i].ino && i < PATH_MAX; ++i) {
|
for (i = 0; i < PATH_MAX && tree[i].ino; ++i) {
|
||||||
if (ino == tree[i].ino && dev == tree[i].dev)
|
if (ino == tree[i].ino && dev == tree[i].dev)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user