Fix for zeroes in data.

git-svn-id: file:///svn/unbound/trunk@2266 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2010-09-29 16:11:14 +00:00
parent 57b3409e2a
commit cbe4354928

View file

@ -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. * zero terminates.
* skips "\r\n" (but not copied to buf). * skips "\r\n" (but not copied to buf).
* @param ssl: the SSL connection to read from (blocking). * @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 /* the result is zero terminated for robustness, but we
* do not include that in the BIO len (for binary data) */ * do not include that in the BIO len (for binary data) */
len = (size_t)l-1; len = (size_t)l-1;
data = strdup(d); data = (char*)malloc(l);
if(data == NULL) { if(data == NULL) {
if(verb) printf("out of memory\n"); if(verb) printf("out of memory\n");
return NULL; return NULL;
} }
memcpy(data, d, l);
BIO_free(tmp); BIO_free(tmp);
} else { } else {
data = read_data_chunk(ssl, len); data = read_data_chunk(ssl, len);
@ -1870,7 +1871,7 @@ extern int optind;
/** getopt global, in case header files fail to declare it. */ /** getopt global, in case header files fail to declare it. */
extern char* optarg; extern char* optarg;
/** Main routine for checkconf */ /** Main routine for unbound-anchor */
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int c; int c;