From cbe4354928e90d16d9c48e10383da66711cf9a74 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Wed, 29 Sep 2010 16:11:14 +0000 Subject: [PATCH] Fix for zeroes in data. git-svn-id: file:///svn/unbound/trunk@2266 be551aaa-1e26-0410-a405-d3ace91eadb9 --- smallapp/unbound-anchor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/smallapp/unbound-anchor.c b/smallapp/unbound-anchor.c index b6ae4cd5e..2a643b054 100644 --- a/smallapp/unbound-anchor.c +++ b/smallapp/unbound-anchor.c @@ -811,7 +811,7 @@ process_one_header(char* buf, size_t* clen, int* chunked) } /** - * Read one file from SSL + * Read one line from SSL * zero terminates. * skips "\r\n" (but not copied to buf). * @param ssl: the SSL connection to read from (blocking). @@ -1018,11 +1018,12 @@ read_http_result(SSL* ssl) /* the result is zero terminated for robustness, but we * do not include that in the BIO len (for binary data) */ len = (size_t)l-1; - data = strdup(d); + data = (char*)malloc(l); if(data == NULL) { if(verb) printf("out of memory\n"); return NULL; } + memcpy(data, d, l); BIO_free(tmp); } else { data = read_data_chunk(ssl, len); @@ -1870,7 +1871,7 @@ extern int optind; /** getopt global, in case header files fail to declare it. */ extern char* optarg; -/** Main routine for checkconf */ +/** Main routine for unbound-anchor */ int main(int argc, char* argv[]) { int c; -- 2.47.2