diff --git a/doc/TODO.020 b/doc/TODO.020 index f524e1bd3..cee44befb 100644 --- a/doc/TODO.020 +++ b/doc/TODO.020 @@ -3,8 +3,8 @@ description of the patch.) Backport for 0.2.0: - - r17891: Fix a fun OpenBSD warning. - - r17892: Fix another fun OpenBSD warning. + o r17891: Fix a fun OpenBSD warning. + o r17892: Fix another fun OpenBSD warning. Backport for 0.2.0 once better tested: Xo r16621: Make some DNS code more robust (partial; see also libevent diff --git a/src/common/torgzip.c b/src/common/torgzip.c index d1289443e..103f2025d 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -143,7 +143,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); } diff --git a/src/common/util.c b/src/common/util.c index b57d8a9f8..af6c3d02a 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -73,8 +73,13 @@ const char util_c_id[] = "$Id$"; #include #endif #ifdef HAVE_MALLOC_H +#ifndef OPENBSD +/* OpenBSD has a malloc.h, but for our purposes, it only exists in order to + * scold us for being so stupid as to autodetect its presence. To be fair, + * they've done this since 1996, when autoconf was only 5 years old. */ #include #endif +#endif /* ===== * Memory management diff --git a/src/or/directory.c b/src/or/directory.c index 9f1f130c5..d0671fccf 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -8,8 +8,10 @@ const char directory_c_id[] = #include "or.h" #if defined(EXPORTMALLINFO) && defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO) +#ifndef OPENBSD #include #endif +#endif /** * \file directory.c