maybe appease the overflow detectors more

svn:r13663
This commit is contained in:
Roger Dingledine 2008-02-21 21:56:04 +00:00
parent daefbfe691
commit 1cd90948ab
2 changed files with 2 additions and 3 deletions

View File

@ -292,7 +292,6 @@ DECLARE_MAP_FNS(digestmap_t, const char *, digestmap_);
MAP_FOREACH_MODIFY(strmap_, map, const char *, keyvar, valtype, valvar)
#define STRMAP_FOREACH_END MAP_FOREACH_END
void* strmap_set_lc(strmap_t *map, const char *key, void *val);
void* strmap_get_lc(const strmap_t *map, const char *key);
void* strmap_remove_lc(strmap_t *map, const char *key);

View File

@ -842,8 +842,8 @@ client_dns_incr_failures(const char *address)
ent->expires = time(NULL) + MAX_DNS_ENTRY_AGE;
strmap_set(addressmap,address,ent);
}
if (++ent->num_resolve_failures < 0) /* overflow. */
ent->num_resolve_failures = SHORT_MAX;
if (ent->num_resolve_failures < SHORT_MAX)
++ent->num_resolve_failures; /* don't overflow */
log_info(LD_APP, "Address %s now has %d resolve failures.",
safe_str(address), ent->num_resolve_failures);
return ent->num_resolve_failures;