summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Chaudhari <prashantsc@gmail.com>2018-03-04 22:53:32 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-03-04 22:54:29 +0100
commitc5a5e9a8fca8636546343f9877c01bae7584c62e (patch)
tree94820b1bb761a7772f8e0204d747cb7b95850c12
parentc74521628bf5c7172b2df06dcc7db6ac2fd6bcb3 (diff)
downloadcurl-bagder/clear-free-strings.tar.gz
cleanup: zero set strings before freeing thembagder/clear-free-strings
... to avoid having sensitive data lingering around in the heap after use. URL: https://curl.haxx.se/mail/lib-2018-03/0012.html
-rw-r--r--lib/url.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 945d4e327..542929365 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -278,6 +278,9 @@ void Curl_freeset(struct Curl_easy *data)
/* Free all dynamic strings stored in the data->set substructure. */
enum dupstring i;
for(i = (enum dupstring)0; i < STRING_LAST; i++) {
+ if(data->set.str[i])
+ /* clear them before free to make sure no sensitive data linger around */
+ memset(data->set.str[i], 0, strlen(data->set.str[i]));
Curl_safefree(data->set.str[i]);
}