aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-11-17 14:29:54 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-11-17 14:29:54 +0000
commit4022a60ea7f88650f1b4abfe1e41c973cca7861d (patch)
tree1864df6f2a37c0f938f8a5cc5838463f6b4c1314 /lib
parent39e366fc11f848c0424d75a914ce98a0e39995f0 (diff)
I extended a patch from David Shaw to make libcurl _always_ provide an error
string in the given error buffer to address the flaw mention on 21 sep 2005.
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 1706ccb6f..664a412bd 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -2217,6 +2217,19 @@ CURLcode Curl_perform(struct SessionHandle *data)
if(newurl)
free(newurl);
+ if(res && !data->state.errorbuf) {
+ /*
+ * As an extra precaution: if no error string has been set and there was
+ * an error, use the strerror() string or if things are so bad that not
+ * even that is good, set a bad string that mentions the error code.
+ */
+ char *str = curl_easy_strerror(res);
+ if(!str)
+ failf(data, "unspecified error %d", (int)res);
+ else
+ failf(data, "%s", str);
+ }
+
/* run post-transfer uncondionally, but don't clobber the return code if
we already have an error code recorder */
res2 = Curl_posttransfer(data);