Commit Graph

58 Commits

Author SHA1 Message Date
Carsten Larsen 2811e30d49 Release 1.12.0 2017-04-12 01:21:06 +02:00
David Drysdale f1bcfa1122 api: Allow injection of user-specified malloc/free functions
Add a new ares_library_init_mem() initialization function for the
library which allows the library user to specify their own malloc,
realloc & free equivalents for use library-wide.

Store these function pointers in library-wide global variables,
defaulting to libc's malloc(), realloc() and free().

Change all calls to malloc, realloc and free to use the function pointer
instead.  Also ensure that ares_strdup() is always available
(even if the local environment includes strdup(3)), and change the
library code to always use it.

Convert calls to calloc() to use ares_malloc() + memset
2016-02-02 10:05:07 +00:00
David Drysdale d493e9b17c api: Add option to expose some internal functions
Purely for testing, add --enable-expose-statics option to configure
which converts some static internal functions to be externally visible.
2016-02-02 10:05:07 +00:00
David Drysdale 87ff25049c Mark unhittable lines
Add comments for the benefit of the lcov tool, marking
lines that cannot be hit.  Typically these are fall-back
protection arms that are already covered by earlier checks,
and so it's not worth taking out the unhittable code (in case
someone changes the code between the two places in future).
2016-02-02 10:05:07 +00:00
David Drysdale de04975c48 ares_striendstr: fix so non-NULL return can happen
This looks to have been broken since it was first introduced in 2005 in
commit aba0b775ea ("Added ares_getnameinfo which mimics the
getnameinfo API")
2016-01-24 09:05:40 +00:00
Gregor Jasny 9456c39934 Prevent tmpbuf from overrunning
Fix Coverity error CID 56886.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2014-09-30 16:49:56 +01:00
Daniel Stenberg cf7ad9758d ares_inet_pton/ntop: cleanup
Make sure that the symbols are always exported and present in c-ares.

Make the headers prefixed with 'ares'.

Removed the inet_ntop.h version as it no longer features any content.
2013-02-17 17:44:02 +01:00
Yang Tse 0c677f578e setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
Inclusion of these two header files now done in setup_once.h
2012-12-14 18:36:59 +01:00
Yang Tse a1035276c1 Header inclusion clean-up
Remove header inclusions already done in setup_once.h
2012-12-14 18:25:56 +01:00
Denis Bilenko 1f8f14d21e ares_getnameinfo: fix random results with c-ares 1.7.5
In ares_getnameinfo memcpy did not copy enough bytes, causing
it to return arbitrary memory contents as a result.
2011-08-24 18:37:11 +02:00
Jakub Hrozek 22c527cc87 Use correct sizeof in ares_getnameinfo() 2011-06-14 19:04:23 +02:00
Yang Tse f413fce823 compiler warning: fix
Fix compiler warning: conversion may lose significant bits
2011-05-26 16:06:40 +02:00
Yang Tse 461fa89e0a ares_getnameinfo: Partially revert commit 85520d66e0
Upon socket address family and length validation failure return ARES_ENOTIMP
in callback again, this is the error code documented in man page and used
mostly all over the library.
2010-11-16 20:15:55 +01:00
Yang Tse 85520d66e0 ares_getnameinfo: Validate socket address family and length.
Validate socket address family and that the socket address length is appropriate
for the specified family. Failure is reported with ARES_EBADFAMILY in callback.
2010-11-16 19:41:03 +01:00
Yang Tse 690f9a726c ares_getnameinfo: fix two compiler warnings 2010-11-16 19:08:07 +01:00
Yang Tse 4ab5eb6631 Revert commit 494274e653 2010-11-13 14:06:44 +01:00
Yang Tse dac69d52c2 Fix compiler warning: array subscript has type 'char' 2010-11-12 19:46:13 +01:00
Yang Tse 494274e653 Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'. 2010-11-12 19:00:29 +01:00
Andrew C. Morrow d6b8698941 fix memory leak in ares_getnameinfo 2010-06-16 15:44:19 +08:00
Daniel Stenberg 0e8dc6f18e style: make code less than 80 columns wide 2010-06-02 23:10:21 +02:00
Daniel Stenberg 63627fa5ab remove all $Id$ lines 2010-03-27 19:42:02 +01:00
Yang Tse 8fe746fcf2 Added IPv6 name servers support 2010-03-05 20:01:47 +00:00
Yang Tse 52d5de9cc1 Remove unneeded preprocessor directives 2009-11-09 12:56:11 +00:00
Yang Tse a82a8fbf82 Renamed c-ares setup.h to ares_setup.h 2009-11-02 11:55:53 +00:00
Yang Tse 85442b2a4b Attempt to silence bogus compiler warning: "Potential null pointer dereference" 2009-09-17 11:45:27 +00:00
Yang Tse 3a55bbebf1 Use build-time configured ares_socklen_t instead of socklen_t 2009-05-02 02:36:47 +00:00
Dan Fandrich 9c51eb28fc Make use of gethostname() conditional on it being available 2008-11-28 22:41:14 +00:00
Yang Tse 898e10bd60 improve detection of getservbyport_r() 2008-09-17 11:31:37 +00:00
Yang Tse f214b583f5 adjust inclusion of "nameser.h" 2008-09-17 01:02:57 +00:00
Yang Tse f2582d6949 include header file only when available 2008-09-15 17:14:29 +00:00
Yang Tse 2cb5cbba34 move inclusion of ares_private.h last 2008-09-11 03:46:47 +00:00
Steinar H. Gunderson b7dec81498 Another timeout fix in ares_getnameinfo(). 2007-10-04 08:09:52 +00:00
Steinar H. Gunderson d5919bbe17 Send the timeout count in ares_getnameinfo(). 2007-10-04 08:09:04 +00:00
Steinar H. Gunderson 50ba81cd23 Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.) 2007-09-28 14:46:51 +00:00
Gunter Knauf 316c126447 few minor changes to make ares compile for NetWare CLIB architecture. 2007-07-03 16:00:36 +00:00
Gisle Vanem a627160041 Removed inclusion of <sys/types.h> in .c-files
since it's already included through "setup.h".
2007-02-26 04:33:19 +00:00
Yang Tse b9c00a23ce compiler warning fix 2007-02-06 03:31:27 +00:00
Yang Tse 12393dcd5c compiler warning fix 2007-02-05 04:10:32 +00:00
Yang Tse 7fe31e4d00 compiler warning fix 2007-02-02 17:16:06 +00:00
Yang Tse 145117174e compiler warning fix 2007-02-01 15:36:56 +00:00
Yang Tse fb38ee15e2 compiler warning fix 2007-02-01 01:42:13 +00:00
Yang Tse 3c90d9d6d3 fix compiler warning "discards qualifiers from pointer target type" in debug builds 2007-01-29 20:56:27 +00:00
Gisle Vanem 4df9c29084 Fixed "'x' might be used uninitialized in this function" warning.
Removed trailing whitespace.
2006-10-25 14:16:01 +00:00
Daniel Stenberg 1bec3073dc Brad Spencer did
o made ares_version.h use extern "C" for c++ compilers
 o fixed compiler warnings in ares_getnameinfo.c
 o fixed a buffer position init for TCP reads
2006-08-29 15:17:47 +00:00
Yang Tse ed8eeae98e Undo last changes 2005-12-11 23:37:58 +00:00
Yang Tse b4e6ca49d8 Fix compiler warning and compatibility issue with the type of the parameter used in getnameinfo() to receive the length of the sockaddr struct. 2005-12-11 12:03:01 +00:00
Yang Tse 6681cc24e9 Modified lookup_service() to avoid the risk of a potential buffer overflow 2005-12-10 19:21:59 +00:00
Yang Tse bc727dff6a Fix compiler warning 2005-12-09 22:23:50 +00:00
Daniel Stenberg 1638613891 Change based on Yang Tse's excellent fix to reduce buffer overflow risk and
fixing a compiler warning in the append_scopeid() function.
2005-11-25 22:14:28 +00:00
Daniel Stenberg fab5b5e116 avoid doing #if an a predef symbol that might not be defined 2005-11-24 23:03:25 +00:00