summaryrefslogtreecommitdiff
path: root/ares_mkquery.c
diff options
context:
space:
mode:
authorSteinar H. Gunderson <sesse@google.com>2007-09-29 13:56:36 +0000
committerSteinar H. Gunderson <sesse@google.com>2007-09-29 13:56:36 +0000
commit22c2794e764e6a40f28d997a495714b5e6369758 (patch)
tree0abaaf8f26e1f800df9cc55041073f2e1ef39694 /ares_mkquery.c
parentcccd9a58cd2ef71da3c2f9e8ed598771edbb2ed7 (diff)
downloadc-ares-22c2794e764e6a40f28d997a495714b5e6369758.tar.gz
c-ares-22c2794e764e6a40f28d997a495714b5e6369758.tar.bz2
c-ares-22c2794e764e6a40f28d997a495714b5e6369758.zip
In ares_mkquery, make sure we set buflen and buf to reasonable values if there's an error. (Patch from the Google tree)
Diffstat (limited to 'ares_mkquery.c')
-rw-r--r--ares_mkquery.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ares_mkquery.c b/ares_mkquery.c
index cfd15a9..9c84446 100644
--- a/ares_mkquery.c
+++ b/ares_mkquery.c
@@ -88,6 +88,10 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
unsigned char *q;
const char *p;
+ /* Set our results early, in case we bail out early with an error. */
+ *buflen = 0;
+ *buf = NULL;
+
/* Compute the length of the encoded name so we can check buflen.
* Start counting at 1 for the zero-length label at the end. */
len = 1;