From: Steinar H. Gunderson Date: Sat, 29 Sep 2007 13:56:36 +0000 (+0000) Subject: In ares_mkquery, make sure we set buflen and buf to reasonable values if there's... X-Git-Tag: curl-7_17_1~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6dd848523c4887b894de388373a688a40fbd83c;p=thirdparty%2Fcurl.git In ares_mkquery, make sure we set buflen and buf to reasonable values if there's an error. (Patch from the Google tree) --- diff --git a/ares/ares_mkquery.c b/ares/ares_mkquery.c index cfd15a9973..9c84446e7c 100644 --- a/ares/ares_mkquery.c +++ b/ares/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;