Avoid walking off the end of the hash table. (Coverity report #465)
parent
ea40d3dd41
commit
14d1219442
|
@ -1,3 +1,8 @@
|
|||
2006-03-14 Adam Jackson <ajax@freedesktop.org>
|
||||
|
||||
* xf86drmHash.c:
|
||||
Avoid walking off the end of the hash table. (Coverity report #465)
|
||||
|
||||
2006-02-20 Adam Jackson <ajax@freedesktop.org>
|
||||
|
||||
* ChangeLog:
|
||||
|
|
|
@ -292,14 +292,15 @@ int drmHashNext(void *t, unsigned long *key, void **value)
|
|||
{
|
||||
HashTablePtr table = (HashTablePtr)t;
|
||||
|
||||
for (; table->p0 < HASH_SIZE;
|
||||
++table->p0, table->p1 = table->buckets[table->p0]) {
|
||||
while (table->p0 < HASH_SIZE) {
|
||||
if (table->p1) {
|
||||
*key = table->p1->key;
|
||||
*value = table->p1->value;
|
||||
table->p1 = table->p1->next;
|
||||
return 1;
|
||||
}
|
||||
table->p1 = table->buckets[table->p0];
|
||||
++table->p0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue