struct DirHeader *dhp;
struct DirEntry *ep;
int code = 0;
+ int elements;
if (DRead(dir, 0, &headerbuf) != 0)
return EIO;
for (i = 0; i < NHASHENT; i++) {
/* For each hash chain, enumerate everyone on the list. */
num = ntohs(dhp->hashTable[i]);
- while (num != 0) {
+ elements = 0;
+ while (num != 0 && elements < BIGMAXPAGES * EPP) {
+ elements++;
+
/* Walk down the hash table list. */
code = afs_dir_GetVerifiedBlob(dir, num, &entrybuf);
if (code)
struct DirBuffer headerbuf, entrybuf;
struct DirHeader *dhp;
struct DirEntry *ep;
+ int elements;
if (DRead(dir, 0, &headerbuf) != 0)
return 0;
for (i = 0; i < NHASHENT; i++) {
/* For each hash chain, enumerate everyone on the list. */
num = ntohs(dhp->hashTable[i]);
- while (num != 0) {
+ elements = 0;
+ while (num != 0 && elements < BIGMAXPAGES * EPP) {
+ elements++;
/* Walk down the hash table list. */
if (afs_dir_GetVerifiedBlob(dir, num, &entrybuf) != 0);
break;
struct DirBuffer curr, prev;
struct DirHeader *dhp;
struct DirEntry *tp;
+ int elements;
memset(prevbuf, 0, sizeof(struct DirBuffer));
memset(itembuf, 0, sizeof(struct DirBuffer));
}
prev.data = &(dhp->hashTable[i]);
+ elements = 0;
+ /* Detect circular hash chains. Absolute max size of a directory */
+ while (elements < BIGMAXPAGES * EPP) {
+ elements++;
- while (1) {
/* Look at each entry on the hash chain */
tp = (struct DirEntry *)curr.data;
if (!strcmp(ename, tp->name)) {
*itembuf = curr;
return 0;
}
+
DRelease(&prev, 0);
prev = curr;
struct DirBuffer curr, header;
struct DirHeader *dhp;
struct DirEntry *tp;
+ int elements;
memset(itembuf, 0, sizeof(struct DirBuffer));
DRelease(&header, 0);
return code;
}
-
- while (curr.data != NULL) {
+ elements = 0;
+ while(curr.data != NULL && elements < BIGMAXPAGES * EPP) {
+ elements++;
tp = (struct DirEntry *)curr.data;
if (vnode == ntohl(tp->fid.vnode)