* handle negative index condition
[citadel.git] / libcitadel / lib / hash.c
index b3c75795bd1438ac130240a054cc9df5e885b055..b8ba8c346839ac267ebcad69e39a835e8bfea0f6 100644 (file)
@@ -619,7 +619,7 @@ int GetNextHashPos(HashList *Hash, HashPos *At, long *HKLen, const char **HashKe
 {
        long PayloadPos;
 
-       if ((Hash == NULL) || (At->Position >= Hash->nMembersUsed))
+       if ((Hash == NULL) || (At->Position >= Hash->nMembersUsed) || (At->Position < 0))
                return 0;
        *HKLen = Hash->LookupTable[At->Position]->HKLen;
        *HashKey = Hash->LookupTable[At->Position]->HashKey;