]> git.ipfire.org Git - pakfire.git/commitdiff
downloader: Fix cURL logging
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Sep 2023 17:17:06 +0000 (17:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Sep 2023 17:17:06 +0000 (17:17 +0000)
Log lines are not NULL-terminated and so we should not read further than
indicated.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/downloader.c

index 38fad822bb78783e646d6a5f35cbcf2b29d6837b..efa823badc88ee7eab626ce1c11f13c878adbc8f 100644 (file)
@@ -236,16 +236,16 @@ static int debug_callback(CURL *handle, curl_infotype type,
 
        switch (type) {
                case CURLINFO_TEXT:
-                       DEBUG(pakfire, "cURL: %s", data);
+                       DEBUG(pakfire, "cURL: %.*s", (int)size, data);
                        break;
 
                // Log headers
                case CURLINFO_HEADER_IN:
-                       DEBUG(pakfire, "cURL: < %s", data);
+                       DEBUG(pakfire, "cURL: < %.*s", (int)size, data);
                        break;
 
                case CURLINFO_HEADER_OUT:
-                       DEBUG(pakfire, "cURL: > %s", data);
+                       DEBUG(pakfire, "cURL: > %.*s", (int)size, data);
                        break;
 
                // Ignore everything else