aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-04-25 00:50:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-05-01 22:55:29 +0200
commitf2fadf490f66ad364f5a6f0356d626dda5f9a82f (patch)
tree28eb4c8a60a3d9703693d2a5f265893eb97046af /lib
parentb8191e975faa7810ed3d858205b0b3f0d297f0b2 (diff)
failf: use private buffer, don't clobber receive buffer
Diffstat (limited to 'lib')
-rw-r--r--lib/sendf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/sendf.c b/lib/sendf.c
index 84b6b4b2f..a7b33c286 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -243,21 +243,20 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
{
va_list ap;
size_t len;
+ char error[CURL_ERROR_SIZE + 2];
va_start(ap, fmt);
- vsnprintf(data->state.buffer, BUFSIZE, fmt, ap);
+ vsnprintf(error, CURL_ERROR_SIZE, fmt, ap);
+ len = strlen(error);
if(data->set.errorbuffer && !data->state.errorbuf) {
- snprintf(data->set.errorbuffer, CURL_ERROR_SIZE, "%s", data->state.buffer);
+ strcpy(data->set.errorbuffer, error);
data->state.errorbuf = TRUE; /* wrote error string */
}
if(data->set.verbose) {
- len = strlen(data->state.buffer);
- if(len < BUFSIZE - 1) {
- data->state.buffer[len] = '\n';
- data->state.buffer[++len] = '\0';
- }
- Curl_debug(data, CURLINFO_TEXT, data->state.buffer, len, NULL);
+ error[len] = '\n';
+ error[++len] = '\0';
+ Curl_debug(data, CURLINFO_TEXT, error, len, NULL);
}
va_end(ap);