diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-01-04 23:15:42 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-01-04 23:15:42 +0000 |
commit | 765bb14f69e1d8a7998025a690ef4ca3dc56d756 (patch) | |
tree | acd13d8803f52e5b91e4c27df47a6b646d16f8f7 /src/common/torgzip.c | |
parent | 743c6c827778533fcbd7b3075311dc5c547b9846 (diff) | |
download | tor-765bb14f69e1d8a7998025a690ef4ca3dc56d756.tar.gz tor-765bb14f69e1d8a7998025a690ef4ca3dc56d756.zip |
Another fun openbsd warning fix. On ioerror's computer at least, they redefined an unsigned field in zlib.h to be signed. I am quite sure this makes me more secure somehow.
svn:r17892
Diffstat (limited to 'src/common/torgzip.c')
-rw-r--r-- | src/common/torgzip.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 0347d59eb4..180c1e6dfd 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -140,7 +140,16 @@ tor_gzip_compress(char **out, size_t *out_len, } done: *out_len = stream->total_out; - if (stream->total_out > out_size + 4097) { +#ifdef OPENBSD + /* "Hey Rocky! Watch me change an unsigned field to a signed field in a + * third-party API!" + * "Oh, that trick will just make people do unsafe casts to the unsigned + * type in their cross-platform code!" + * "Don't be foolish. I'm _sure_ they'll have the good sense to make sure + * the newly unsigned field isn't negative." */ + tor_assert(stream->total_out >= 0); +#endif + if (((size_t)stream->total_out) > out_size + 4097) { /* If we're wasting more than 4k, don't. */ *out = tor_realloc(*out, stream->total_out + 1); } |