diff options
author | Steinar H. Gunderson <sesse@google.com> | 2007-09-29 13:56:36 +0000 |
---|---|---|
committer | Steinar H. Gunderson <sesse@google.com> | 2007-09-29 13:56:36 +0000 |
commit | d6dd848523c4887b894de388373a688a40fbd83c (patch) | |
tree | 7b1abc1d502e7a65d9ed9efa14f7643c16ba9363 /ares | |
parent | 9fc66e4dd966f18a8dbe7f251ab2a791dc8b8f23 (diff) |
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')
-rw-r--r-- | ares/ares_mkquery.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ares/ares_mkquery.c b/ares/ares_mkquery.c index cfd15a997..9c84446e7 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; |