diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2009-09-01 05:23:47 +0200 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2009-09-01 22:16:46 +0200 |
commit | 0a71d1c6a7289cbadcef5f4a28dd94307decc5be (patch) | |
tree | 3a49133baf8c81fd7f962d9c0a8f01f63cb26a64 /src/or/routerparse.c | |
parent | a95947b0d74ec8313313919624ec99a62b91ff5c (diff) | |
download | tor-0a71d1c6a7289cbadcef5f4a28dd94307decc5be.tar.gz tor-0a71d1c6a7289cbadcef5f4a28dd94307decc5be.zip |
Fix compile warnings on Snow Leopard
Big thanks to nickm and arma for helping me with this!
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 0fb08d8cec..4137dd2812 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2012,8 +2012,9 @@ routerstatus_parse_entry_from_string(memarea_t *area, rs->has_bandwidth = 1; } else if (!strcmpstart(tok->args[i], "Measured=")) { int ok; - rs->measured_bw = tor_parse_ulong(strchr(tok->args[i], '=')+1, 10, - 0, UINT32_MAX, &ok, NULL); + rs->measured_bw = + (uint32_t)tor_parse_ulong(strchr(tok->args[i], '=')+1, + 10, 0, UINT32_MAX, &ok, NULL); if (!ok) { log_warn(LD_DIR, "Invalid Measured Bandwidth %s", escaped(tok->args[i])); @@ -3517,9 +3518,11 @@ tor_version_parse(const char *s, tor_version_t *out) if (! close_paren) return -1; cp += 5; - hexlen = (close_paren-cp); + if (close_paren-cp > HEX_DIGEST_LEN) + return -1; + hexlen = (int)(close_paren-cp); memset(digest, 0, sizeof(digest)); - if (hexlen > HEX_DIGEST_LEN || hexlen == 0 || (hexlen % 2) == 1) + if ( hexlen == 0 || (hexlen % 2) == 1) return -1; if (base16_decode(digest, hexlen/2, cp, hexlen)) return -1; |