diff options
author | Sterling Hughes <sterling@php.net> | 2000-09-11 03:33:14 +0000 |
---|---|---|
committer | Sterling Hughes <sterling@php.net> | 2000-09-11 03:33:14 +0000 |
commit | d44d114b758e30bc109011dab2f93d8698ba2b52 (patch) | |
tree | 1a01c3c45d9ad6be4b9f99682e7dcf0cd6aa564a | |
parent | 43e62ac46edb9ba5f72b88686d33bb30e89b1d0f (diff) | |
download | php-git-d44d114b758e30bc109011dab2f93d8698ba2b52.tar.gz |
@- Fix bug with curl places extra data in the output. (medvitz@medvitz.net)
-rw-r--r-- | ext/curl/curl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/curl/curl.c b/ext/curl/curl.c index ff9c0bc2c7..3575445b11 100644 --- a/ext/curl/curl.c +++ b/ext/curl/curl.c @@ -348,6 +348,7 @@ PHP_FUNCTION(curl_exec) FILE *fp; char buf[4096]; int b; + unsigned long pos = 0; CURLLS_FETCH(); @@ -408,8 +409,10 @@ PHP_FUNCTION(curl_exec) ret_data = emalloc((stat_sb.st_size+1)*sizeof(char)); while ((b = fread(buf, 1, sizeof(buf), fp)) > 0) { - strcat(ret_data, buf); + memcpy(&(ret_data[pos]), buf, b); + pos += b; } + ret_data[stat_sb.st_size - 1] = '\0'; RETURN_STRINGL(ret_data, stat_sb.st_size, 0); |