git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@2079 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2006/07/14 21:13:58... | ... |
@@ -141,7 +141,7 @@ tableFind(const table_t *table, const char *key) |
141 | 141 |
#ifdef CL_DEBUG |
142 | 142 |
cost++; |
143 | 143 |
#endif |
144 |
- if(strcasecmp(tableItem->key, key) == 0) { |
|
144 |
+ if(tableItem->key && (strcasecmp(tableItem->key, key) == 0)) { |
|
145 | 145 |
#ifdef CL_DEBUG |
146 | 146 |
cli_dbgmsg("tableFind: Cost of '%s' = %d\n", key, cost); |
147 | 147 |
#endif |
... | ... |
@@ -171,7 +171,7 @@ tableUpdate(table_t *table, const char *key, int new_value) |
171 | 171 |
return tableInsert(table, key, new_value); |
172 | 172 |
|
173 | 173 |
for(tableItem = table->tableHead; tableItem; tableItem = tableItem->next) |
174 |
- if(strcasecmp(tableItem->key, key) == 0) { |
|
174 |
+ if(tableItem->key && (strcasecmp(tableItem->key, key) == 0)) { |
|
175 | 175 |
tableItem->value = new_value; |
176 | 176 |
return new_value; |
177 | 177 |
} |
... | ... |
@@ -198,7 +198,7 @@ tableRemove(table_t *table, const char *key) |
198 | 198 |
return; |
199 | 199 |
|
200 | 200 |
for(tableItem = table->tableHead; tableItem; tableItem = tableItem->next) |
201 |
- if(strcasecmp(tableItem->key, key) == 0) { |
|
201 |
+ if(tableItem->key && (strcasecmp(tableItem->key, key) == 0)) { |
|
202 | 202 |
free(tableItem->key); |
203 | 203 |
tableItem->key = NULL; |
204 | 204 |
table->flags |= TABLE_HAS_DELETED_ENTRIES; |
... | ... |
@@ -221,5 +221,4 @@ tableIterate(table_t *table, void(*callback)(char *key, int value)) |
221 | 221 |
for(tableItem = table->tableHead; tableItem; tableItem = tableItem->next) |
222 | 222 |
if(tableItem->key) /* check leaf is not deleted */ |
223 | 223 |
(*callback)(tableItem->key, tableItem->value); |
224 |
- |
|
225 | 224 |
} |