[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 144/411: tool_writeout: protect fputs() from NULL
From: |
gnunet |
Subject: |
[gnurl] 144/411: tool_writeout: protect fputs() from NULL |
Date: |
Wed, 13 Jan 2021 01:19:19 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 0b4c4145aac87047513e30a348e63fde96da892d
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Tue Sep 15 15:53:13 2020 +0200
tool_writeout: protect fputs() from NULL
When the code was changed to do fputs() instead of fprintf() it got
sensitive for NULL pointers; add checks for that.
Follow-up from 0c1e767e83ec66
Closes #5963
---
src/tool_writeout.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/tool_writeout.c b/src/tool_writeout.c
index 63d2cd003..393e16861 100644
--- a/src/tool_writeout.c
+++ b/src/tool_writeout.c
@@ -284,9 +284,8 @@ void ourWriteOut(CURL *curl, struct per_transfer *per,
const char *writeinfo)
fputs(per->outs.filename, stream);
break;
case VAR_PRIMARY_IP:
- if(CURLE_OK ==
- curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP,
- &stringp))
+ if((CURLE_OK == curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP,
+ &stringp)) && stringp)
fputs(stringp, stream);
break;
case VAR_PRIMARY_PORT:
@@ -296,9 +295,8 @@ void ourWriteOut(CURL *curl, struct per_transfer *per,
const char *writeinfo)
fprintf(stream, "%ld", longinfo);
break;
case VAR_LOCAL_IP:
- if(CURLE_OK ==
- curl_easy_getinfo(curl, CURLINFO_LOCAL_IP,
- &stringp))
+ if((CURLE_OK == curl_easy_getinfo(curl, CURLINFO_LOCAL_IP,
+ &stringp)) && stringp)
fputs(stringp, stream);
break;
case VAR_LOCAL_PORT:
@@ -331,9 +329,8 @@ void ourWriteOut(CURL *curl, struct per_transfer *per,
const char *writeinfo)
}
break;
case VAR_SCHEME:
- if(CURLE_OK ==
- curl_easy_getinfo(curl, CURLINFO_SCHEME,
- &stringp))
+ if((CURLE_OK == curl_easy_getinfo(curl, CURLINFO_SCHEME,
+ &stringp)) && stringp)
fputs(stringp, stream);
break;
case VAR_STDOUT:
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 155/411: ftp: get rid of the PPSENDF macro, (continued)
- [gnurl] 155/411: ftp: get rid of the PPSENDF macro, gnunet, 2021/01/12
- [gnurl] 167/411: parsedate: tune the date to epoch conversion, gnunet, 2021/01/12
- [gnurl] 146/411: tool_help.h: update copyright year range, gnunet, 2021/01/12
- [gnurl] 164/411: docs/MQTT: not experimental anymore, gnunet, 2021/01/12
- [gnurl] 178/411: dynbuf: make *addf() not require extra mallocs, gnunet, 2021/01/12
- [gnurl] 157/411: ftp: avoid risk of reading uninitialized integers, gnunet, 2021/01/12
- [gnurl] 170/411: setopt: return CURLE_BAD_FUNCTION_ARGUMENT on bad argument, gnunet, 2021/01/12
- [gnurl] 185/411: strerror: honor Unicode API choice on Windows, gnunet, 2021/01/12
- [gnurl] 176/411: pingpong: remove a malloc per Curl_pp_vsendf call, gnunet, 2021/01/12
- [gnurl] 125/411: dynbuf: make sure Curl_dyn_tail() zero terminates, gnunet, 2021/01/12
- [gnurl] 144/411: tool_writeout: protect fputs() from NULL,
gnunet <=
- [gnurl] 160/411: --help: strdup the category, gnunet, 2021/01/12
- [gnurl] 165/411: docs/MQTT: remove outdated paaragraphs, gnunet, 2021/01/12
- [gnurl] 175/411: symbian: drop support, gnunet, 2021/01/12
- [gnurl] 152/411: github: use new issue template feature, gnunet, 2021/01/12
- [gnurl] 171/411: http_proxy: do not count proxy headers in the header bytecount, gnunet, 2021/01/12
- [gnurl] 166/411: cmake: remove scary warning, gnunet, 2021/01/12
- [gnurl] 151/411: urlapi: use more Curl_safefree, gnunet, 2021/01/12
- [gnurl] 135/411: curl: make checkpasswd use dynbuf, gnunet, 2021/01/12
- [gnurl] 77/411: llist: make it "struct Curl_llist", gnunet, 2021/01/12
- [gnurl] 186/411: ngtcp2: adapt to new NGTCP2_PROTO_VER_MAX define, gnunet, 2021/01/12