From 93ab2f38c9a40854a0e8e99e8ac313a1d9d91db2 Mon Sep 17 00:00:00 2001 From: Ian Roddis Date: Thu, 24 Feb 2022 10:46:52 -0400 Subject: [PATCH] Adding fix for uninitialized char * --- libdaggy/src/Utilities.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libdaggy/src/Utilities.cpp b/libdaggy/src/Utilities.cpp index f562b4e..f49dab6 100644 --- a/libdaggy/src/Utilities.cpp +++ b/libdaggy/src/Utilities.cpp @@ -8,34 +8,36 @@ using namespace std::chrono_literals; static int http_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) { - const char *text; + const char *text = ""; (void)handle; /* prevent compiler warning */ (void)userp; + // from curl.h switch (type) { case CURLINFO_TEXT: - fprintf(stderr, "== Info: %s", data); - default: /* in case a new one is introduced to shock us */ - return 0; - - case CURLINFO_HEADER_OUT: - text = "=> Send header"; - break; - case CURLINFO_DATA_OUT: - text = "=> Send data"; - break; - case CURLINFO_SSL_DATA_OUT: - text = "=> Send SSL data"; + text = "== Info"; break; case CURLINFO_HEADER_IN: text = "<= Recv header"; break; + case CURLINFO_HEADER_OUT: + text = "=> Send header"; + break; case CURLINFO_DATA_IN: text = "<= Recv data"; break; + case CURLINFO_DATA_OUT: + text = "=> Send data"; + break; case CURLINFO_SSL_DATA_IN: text = "<= Recv SSL data"; break; + case CURLINFO_SSL_DATA_OUT: + text = "=> Send SSL data"; + break; + default: /* in case a new one is introduced to shock us */ + text = "?? Unknown curl_infotype"; + break; } std::cerr << "\n================== " << text