diff --git a/INSTALL.md b/INSTALL.md index 738375ec..de766aad 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -32,7 +32,7 @@ the same for both Git and official release tarballs. AutoTools Build =============== -### General Information, works on most Unix Platforms (Linux, FreeBSD, etc) +### General Information, works on most Unix Platforms (Linux, FreeBSD, etc.) A normal Unix installation is made in three or four steps (after you've unpacked the source archive): @@ -57,7 +57,7 @@ you need to specify that already when running configure: If you happen to have write permission in that directory, you can do `make install` without being root. An example of this would be to make a local -install in your own home directory: +installation in your own home directory: ./configure --prefix=$HOME make @@ -183,7 +183,7 @@ Method using a configure cross-compile (tested with Android NDK r7b): ./tools/make-standalone-toolchain.sh - which creates a usual cross-compile toolchain. Lets assume that you put + which creates a usual cross-compile toolchain. Let's assume that you put this toolchain below `/opt` then invoke configure with something like: @@ -213,7 +213,7 @@ CMake builds ============ Current releases of c-ares introduce a CMake v3+ build system that has been -tested on most platforms including Windows, Linux, FreeBSD, MacOS, AIX and +tested on most platforms including Windows, Linux, FreeBSD, macOS, AIX and Solaris. In the most basic form, building with CMake might look like: @@ -233,12 +233,17 @@ Options Options to CMake are passed on the command line using "-D${OPTION}=${VALUE}". The values defined are all boolean and take values like On, Off, True, False. -* CARES_STATIC - Build the static library (off by default) -* CARES_SHARED - Build the shared library (on by default) -* CARES_INSTALL - Hook in installation, useful to disable if chain building -* CARES_STATIC_PIC - Build the static library as position-independent (off by - default) - +| Option Name | Description | Default Value | +|-----------------------------|-----------------------------------------------------------------------|----------------| +| CARES_STATIC | Build the static library | Off | +| CARES_SHARED | Build the shared library | On | +| CARES_INSTALL | Hook in installation, useful to disable if chain building | On | +| CARES_STATIC_PIC | Build the static library as position-independent | Off | +| CARES_BUILD_TESTS | Build and run tests | Off | +| CARES_BUILD_CONTAINER_TESTS | Build and run container tests (implies CARES_BUILD_TESTS, Linux only) | Off | +| CARES_BUILD_TOOLS | Build tools | On | +| CARES_SYMBOL_HIDING | Hide private symbols in shared libraries | Off | +| CARES_THREADS | Build with thread-safety support | On | Ninja ----- diff --git a/README.md b/README.md index 29788a8a..2d9e0fff 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Notes for c-ares hackers * If you intend to distribute an already compiled c-ares library you **MUST** also distribute along with it the generated `ares_build.h` which has been - used to compile it. Otherwise the library will be of no use for the users of + used to compile it. Otherwise, the library will be of no use for the users of the library that you have built. It is **your** responsibility to provide this file. No one at the c-ares project can know how you have built the library. diff --git a/src/lib/ares__htable.c b/src/lib/ares__htable.c index 20ce9ca7..39708fe3 100644 --- a/src/lib/ares__htable.c +++ b/src/lib/ares__htable.c @@ -46,7 +46,7 @@ struct ares__htable { * hash collisions we would have O(log n) worst case insert and search * performance. (We'd also need to make key_eq into a key_cmp to * support sort). That said, risk with a random hash seed is near zero, - * and ares__slist_t is heavier weight so I think using ares__llist_t is + * and ares__slist_t is heavier weight, so I think using ares__llist_t * is an overall win. */ ares__llist_t **buckets; }; diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc index 3c88094d..51d7bc11 100644 --- a/test/ares-test-internal.cc +++ b/test/ares-test-internal.cc @@ -235,7 +235,7 @@ TEST_F(LibraryTest, FreeCorruptData) { void* p = &(data->data); // Invalid type - data->type = (ares_datatype)99; + data->type = (ares_datatype)ARES_DATATYPE_LAST; data->mark = ARES_DATATYPE_MARK; ares_free_data(p); diff --git a/test/ares-test-misc.cc b/test/ares-test-misc.cc index 0dbccd0d..41f1639b 100644 --- a/test/ares-test-misc.cc +++ b/test/ares-test-misc.cc @@ -351,8 +351,8 @@ TEST_F(DefaultChannelTest, SendFailure) { EXPECT_EQ(ARES_EBADQUERY, result.status_); } -std::string ExpandName(const std::vector& data, int offset, - long *enclen) { +static std::string ExpandName(const std::vector& data, int offset, + long *enclen) { char *name = nullptr; int rc = ares_expand_name(data.data() + offset, data.data(), (int)data.size(), &name, enclen); diff --git a/test/ares-test.cc b/test/ares-test.cc index 3a55b73d..f9c046f1 100644 --- a/test/ares-test.cc +++ b/test/ares-test.cc @@ -376,8 +376,8 @@ void MockServer::ProcessPacket(ares_socket_t fd, struct sockaddr_storage *addr, << ")" << std::endl; return; } - byte* question = data + 12; - int qlen = len - 12; + byte* question = data + NS_HFIXEDSZ; + int qlen = len - NS_HFIXEDSZ; char *name = nullptr; long enclen; @@ -386,7 +386,11 @@ void MockServer::ProcessPacket(ares_socket_t fd, struct sockaddr_storage *addr, std::cerr << "Failed to retrieve name" << std::endl; return; } - qlen -= enclen; + if (enclen > qlen) { + std::cerr << "(error, encoded name len " << enclen << "bigger than remaining data " << qlen << " bytes)" << std::endl; + return; + } + qlen -= (int)enclen; question += enclen; std::string namestr(name); ares_free_string(name); diff --git a/test/dns-proto.cc b/test/dns-proto.cc index 2482d79b..f7b36054 100644 --- a/test/dns-proto.cc +++ b/test/dns-proto.cc @@ -270,7 +270,7 @@ std::string QuestionToString(const std::vector& packet, ss << "(error, encoded name len " << enclen << "bigger than remaining data " << *len << " bytes)"; return ss.str(); } - *len -= enclen; + *len -= (int)enclen; *data += enclen; ss << "'" << name << "' "; ares_free_string(name); @@ -306,7 +306,7 @@ std::string RRToString(const std::vector& packet, ss << "(error, encoded name len " << enclen << "bigger than remaining data " << *len << " bytes)"; return ss.str(); } - *len -= enclen; + *len -= (int)enclen; *data += enclen; ss << "'" << name << "' "; ares_free_string(name);