Commit Graph

30 Commits

Author SHA1 Message Date
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 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
Patrick Valsecchi 148c8e0353 protocol parsing: check input data stricter
... so that bad length fields aren't blindly accepted

Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml
2013-04-15 22:28:01 +02: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
Yang Tse 14eb79f660 warnings: fix some 'conversion may lose significant bits' compiler warnings 2011-08-20 23:05:14 +02:00
Jakub Hrozek 09f8a05573 Do not leak rr_name on failures inside ares_parse_ptr_reply 2011-06-14 16:52:32 +02:00
Jakub Hrozek 654733a399 Fix incorrect allocation in ares_parse_ptr_reply() 2011-06-14 16:41:29 +02:00
Daniel Stenberg 63627fa5ab remove all $Id$ lines 2010-03-27 19:42:02 +01:00
Yang Tse a82a8fbf82 Renamed c-ares setup.h to ares_setup.h 2009-11-02 11:55:53 +00:00
Daniel Stenberg 8362245c42 - Phil Blundell added the internal function ares__expand_name_for_response()
that is now used by the ares_parse_*_reply() functions instead of the
  ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
  the name expansion fails as in responses that really isn't expected.
2009-01-11 13:49:13 +00:00
Yang Tse 7e39e944ea Gerald Combs fixed a bug in ares_parse_ptr_reply() which would cause a
buffer to shrink instead of expand if a reply contained 8 or more records.
2008-11-26 17:04:35 +00:00
Daniel Stenberg 54056b2063 Fixed an OOM condition reported by Jim Meyering 2008-11-15 23:07:35 +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 f33bd94c05 remove unnecessary typecasting of malloc() 2008-09-06 05:29:05 +00:00
Yang Tse 5d2ace75a3 remove unnecessary typecasting of realloc() 2008-09-06 04:28:43 +00:00
Daniel Stenberg 7829b79768 check for strings.h in configure and use it for the strcasecmp() proto 2008-05-08 22:11:38 +00:00
Daniel Stenberg 0645b841d0 - Sebastian made c-ares able to return all PTR-records when doing reverse
lookups. It is not common practice to have multiple PTR-Records for a single
  IP, but its perfectly legal and some sites have those.
2008-05-07 21:20:45 +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
Gisle Vanem 0a83c1e416 2nd try adding CVS id. 2006-07-22 15:37:10 +00:00
Gisle Vanem f6e7395ca0 Added CVS id. 2006-07-22 15:21:13 +00:00
Daniel Stenberg b41effd113 Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac OS
X.
2005-04-06 22:27:42 +00:00
Daniel Stenberg 3e748f4b50 removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Gisle Vanem 0f51a17667 More patches for Watt-32 on Win32; don't include "nameser.h". 2004-08-20 14:10:44 +00:00
Daniel Stenberg d5f3636a52 - Fixed a few variable return types for some system calls. Made configure
check for ssize_t to make it possible to use that when receiving the send()
  error code. This is necessary to prevent compiler warnings on some systems.

- Made configure create config.h, and all source files now include setup.h that
  might include the proper config.h (or a handicrafted alternative).

- Switched to 'ares_socket_t' type for sockets in ares, since Windows don't
  use 'int' for that.

- automake-ified and libool-ified c-ares. Now it builds libcares as a shared
  lib on most platforms if wanted. (This bloated the size of the release
  archive with another 200K!)

- Makefile.am now uses Makefile.inc for the c sources, h headers and man
  pages, to make it easier for other makefiles to use the exact same set of
  files.

- Adjusted 'maketgz' to use the new automake magic when building distribution
  archives.
2004-07-22 22:18:45 +00:00
Daniel Stenberg 961876c001 make ares_expand_name() take a long * instead of an int *, since we do
pointer arithmetic (ptr1 - ptr2) and to do that properly on 64bit we need
long
2004-02-23 07:52:20 +00:00
Daniel Stenberg 0b59a6bb66 typecast comparision between signed and unsigned 2004-02-04 07:51:30 +00:00
Daniel Stenberg 3d0a7c00df remove rcsid stuff from c files, it serves no useful purpose 2004-02-02 15:59:35 +00:00
Daniel Stenberg 5e847a14bd ares 1.1.1 with collected applied patches 2003-10-07 21:54:04 +00:00