curl/lib
Even Rouault 6e0e152ce5
parse_proxy(): fix memory leak in case of invalid proxy server name
Fixes the below leak:

$ valgrind --leak-check=full ~/install-curl-git/bin/curl --proxy "http://a:b@/x" http://127.0.0.1
curl: (5) Couldn't resolve proxy name
==5048==
==5048== HEAP SUMMARY:
==5048==     in use at exit: 532 bytes in 12 blocks
==5048==   total heap usage: 5,288 allocs, 5,276 frees, 445,271 bytes allocated
==5048==
==5048== 2 bytes in 1 blocks are definitely lost in loss record 1 of 12
==5048==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5048==    by 0x4E6CB79: parse_login_details (url.c:5614)
==5048==    by 0x4E6BA82: parse_proxy (url.c:5091)
==5048==    by 0x4E6C46D: create_conn_helper_init_proxy (url.c:5346)
==5048==    by 0x4E6EA18: create_conn (url.c:6498)
==5048==    by 0x4E6F9B4: Curl_connect (url.c:6967)
==5048==    by 0x4E86D05: multi_runsingle (multi.c:1436)
==5048==    by 0x4E88432: curl_multi_perform (multi.c:2160)
==5048==    by 0x4E7C515: easy_transfer (easy.c:708)
==5048==    by 0x4E7C74A: easy_perform (easy.c:794)
==5048==    by 0x4E7C7B1: curl_easy_perform (easy.c:813)
==5048==    by 0x414025: operate_do (tool_operate.c:1563)
==5048==
==5048== 2 bytes in 1 blocks are definitely lost in loss record 2 of 12
==5048==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5048==    by 0x4E6CBB6: parse_login_details (url.c:5621)
==5048==    by 0x4E6BA82: parse_proxy (url.c:5091)
==5048==    by 0x4E6C46D: create_conn_helper_init_proxy (url.c:5346)
==5048==    by 0x4E6EA18: create_conn (url.c:6498)
==5048==    by 0x4E6F9B4: Curl_connect (url.c:6967)
==5048==    by 0x4E86D05: multi_runsingle (multi.c:1436)
==5048==    by 0x4E88432: curl_multi_perform (multi.c:2160)
==5048==    by 0x4E7C515: easy_transfer (easy.c:708)
==5048==    by 0x4E7C74A: easy_perform (easy.c:794)
==5048==    by 0x4E7C7B1: curl_easy_perform (easy.c:813)
==5048==    by 0x414025: operate_do (tool_operate.c:1563)

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2984
Credit to OSS Fuzz for discovery

Closes #1761
2017-08-11 11:52:56 +02:00
..
vauth digest_sspi: Don't reuse context if the user/passwd has changed 2017-08-10 01:40:05 -04:00
vtls openssl: fix "error: this statement may fall through" 2017-08-11 08:16:17 +02:00
.gitattributes
.gitignore
amigaos.c
amigaos.h
arpa_telnet.h
asyn-ares.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
asyn-thread.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
asyn.h
base64.c
checksrc.pl checksrc: escape open brace in regex 2017-07-27 01:13:19 +02:00
CMakeLists.txt CMake: set MSVC warning level to 4 2017-08-03 08:39:23 +02:00
config-amigaos.h
config-dos.h
config-mac.h
config-os400.h
config-riscos.h
config-symbian.h
config-tpf.h
config-vxworks.h
config-win32.h
config-win32ce.h
conncache.c
conncache.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
connect.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
connect.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
content_encoding.c
content_encoding.h
cookie.c
cookie.h
curl_addrinfo.c
curl_addrinfo.h
curl_base64.h
curl_config.h.cmake build: remove WIN32_LEAN_AND_MEAN from individual build systems 2017-07-11 18:16:23 +02:00
curl_des.c
curl_des.h
curl_endian.c curl_endian: remove unused functions 2017-06-02 13:30:41 +02:00
curl_endian.h curl_endian: remove unused functions 2017-06-02 13:30:41 +02:00
curl_fnmatch.c
curl_fnmatch.h
curl_gethostname.c
curl_gethostname.h
curl_gssapi.c
curl_gssapi.h
curl_hmac.h
curl_ldap.h
curl_md4.h
curl_md5.h
curl_memory.h
curl_memrchr.c
curl_memrchr.h
curl_multibyte.c
curl_multibyte.h
curl_ntlm_core.c curl_ntlm_core: use Curl_raw_toupper instead of toupper 2017-06-05 00:27:29 +02:00
curl_ntlm_core.h
curl_ntlm_wb.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
curl_ntlm_wb.h
curl_printf.h
curl_rtmp.c curl_rtmp: fix a compiler warning 2017-07-28 16:41:29 +02:00
curl_rtmp.h
curl_sasl.c curl_sasl: fix unused-variable warning 2017-06-03 11:59:38 +02:00
curl_sasl.h
curl_sec.h
curl_setup_once.h curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
curl_setup.h curl_setup: Define CURL_NO_OLDIES for building libcurl 2017-08-01 02:56:48 -04:00
curl_sspi.c
curl_sspi.h
curl_threads.c curl_threads: fix MSVC compiler warning 2017-08-01 17:22:30 +02:00
curl_threads.h
curlx.h
dict.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
dict.h
dotdot.c dedotdot: fixed output for ".." and "." only input 2017-06-03 00:11:51 +02:00
dotdot.h
easy.c easy_events: make event data static 2017-08-06 23:42:50 +02:00
easyif.h
escape.c
escape.h
file.c file: output the correct buffer to the user 2017-08-07 09:24:30 +02:00
file.h
fileinfo.c
fileinfo.h
firefox-db2pem.sh
formdata.c
formdata.h
ftp.c FTP: skip unnecessary CWD when in nocwd mode 2017-08-04 10:01:23 +02:00
ftp.h FTP: skip unnecessary CWD when in nocwd mode 2017-08-04 10:01:23 +02:00
ftplistparser.c
ftplistparser.h
getenv.c
getinfo.c getinfo: return sizes as curl_off_t 2017-06-19 09:27:42 +02:00
getinfo.h
gopher.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
gopher.h
hash.c
hash.h
hmac.c
hostasyn.c
hostcheck.c
hostcheck.h
hostip4.c
hostip6.c
hostip.c time: fix type conversions and compiler warnings 2017-05-24 22:56:22 +02:00
hostip.h
hostsyn.c
http2.c http2: handle PING frames 2017-06-30 10:27:41 +02:00
http2.h http2: fix OOM crash 2017-06-18 23:57:45 +02:00
http_chunks.c
http_chunks.h
http_digest.c
http_digest.h
http_negotiate.c
http_negotiate.h
http_ntlm.c
http_ntlm.h
http_proxy.c http_proxy: fix build with http and proxy 2017-06-18 15:18:15 +02:00
http_proxy.h http_proxy: fix build with http and proxy 2017-06-18 15:18:15 +02:00
http.c http: fix response code parser to avoid integer overflow 2017-07-31 18:37:43 +02:00
http.h http: s/TINY_INITIAL_POST_SIZE/EXPECT_100_THRESHOLD 2017-07-06 11:20:57 +02:00
idn_win32.c
if2ip.c if2ip: fix compiler warning in ISO C90 mode 2017-06-20 22:33:56 +02:00
if2ip.h
imap.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
imap.h
inet_ntop.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
inet_ntop.h
inet_pton.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
inet_pton.h inet_pton: fix include on windows to get prototype 2017-07-05 13:28:19 +02:00
krb5.c
ldap.c ldap: fix MinGW compiler warning 2017-07-10 10:22:34 +02:00
libcurl.plist
libcurl.rc
libcurl.vers.in
llist.c
llist.h
Makefile.am includes: remove curl/curlbuild.h and curl/curlrules.h 2017-06-14 11:07:33 +02:00
makefile.amiga curl tool: use configuration files from lib directory - follow-up I 2012-04-07 00:31:24 +02:00
Makefile.b32
makefile.dj lib: fix the djgpp build 2017-06-21 07:46:21 +02:00
Makefile.inc
Makefile.m32 Makefile.m32: enable -W for MinGW32 build 2017-06-16 22:32:22 +02:00
Makefile.netware includes: remove curl/curlbuild.h and curl/curlrules.h 2017-06-14 11:07:33 +02:00
Makefile.vxworks
Makefile.Watcom lib/curl_setup.h: remove CURL_WANTS_CA_BUNDLE_ENV 2017-06-15 11:11:15 +02:00
md4.c MD(4|5): silence cast-align clang warning 2017-06-02 21:58:48 +02:00
md5.c MD(4|5): silence cast-align clang warning 2017-06-02 21:58:48 +02:00
memdebug.c errno: fix non-windows builds after af0216251b 2017-07-10 13:59:05 +02:00
memdebug.h
mk-ca-bundle.pl mk-ca-bundle.pl: Check curl's exit code after certdata download 2017-06-16 01:58:23 -04:00
mk-ca-bundle.vbs
mprintf.c
multi.c multi: fix request timer management 2017-08-01 13:39:38 +02:00
multihandle.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
multiif.h expire: remove Curl_expire_latest() 2017-06-08 10:50:47 +02:00
netrc.c netrc: skip lines starting with '#' 2017-08-03 10:04:16 +02:00
netrc.h
non-ascii.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
non-ascii.h
nonblock.c
nonblock.h
nwlib.c
nwos.c
objnames-test08.sh
objnames-test10.sh
objnames.inc
openldap.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
parsedate.c curl_setup_once: Remove ERRNO/SET_ERRNO macros 2017-07-10 02:09:27 -04:00
parsedate.h
pingpong.c
pingpong.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
pipeline.c PIPELINING_SERVER_BL: cleanup the internal list use 2017-06-19 09:14:49 +02:00
pipeline.h
pop3.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
pop3.h
progress.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
progress.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
rand.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
rand.h
rtsp.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
rtsp.h handler: refactor connection checking 2017-06-30 10:17:27 +02:00
security.c
select.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
select.h select.h: avoid macro redefinition harder 2017-07-05 13:28:28 +02:00
sendf.c
sendf.h
setup-os400.h
setup-vms.h
share.c
share.h
sigpipe.h
slist.c
slist.h
smb.c smb: rename variable to fix shadowing warning 2017-07-09 14:42:13 +02:00
smb.h
smtp.c handler: refactor connection checking 2017-06-30 10:17:27 +02:00
smtp.h
sockaddr.h
socks_gssapi.c
socks_sspi.c
socks.c CURLOPT_SOCKS5_AUTH: allowed methods for SOCKS5 proxy auth 2017-06-28 08:02:58 +02:00
socks.h
speedcheck.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
speedcheck.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
splay.c splay: fix signed/unsigned mismatch warning 2017-07-29 01:13:42 -04:00
splay.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
ssh.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
ssh.h
strcase.c
strcase.h
strdup.c
strdup.h
strerror.c strerror: Preserve Windows error code in some functions 2017-07-11 01:53:23 -04:00
strerror.h
strtok.c
strtok.h
strtoofft.c docs/comments: Update to secure URL versions 2017-08-08 21:41:07 +02:00
strtoofft.h
system_win32.c
system_win32.h
telnet.c libcurl: Stop using error codes defined under CURL_NO_OLDIES 2017-07-31 02:59:05 -04:00
telnet.h
tftp.c tftp: reject file name lengths that don't fit 2017-08-07 09:24:30 +02:00
tftp.h
timeval.c timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
timeval.h timeval: struct curltime is a struct timeval replacement 2017-07-28 15:51:25 +02:00
transfer.c url: make the original string get used on subsequent transfers 2017-07-03 23:52:10 +02:00
transfer.h speed caps: not based on average speeds anymore 2016-09-04 13:11:23 +02:00
url.c parse_proxy(): fix memory leak in case of invalid proxy server name 2017-08-11 11:52:56 +02:00
url.h
urldata.h digest_sspi: Don't reuse context if the user/passwd has changed 2017-08-10 01:40:05 -04:00
version.c
warnless.c
warnless.h
wildcard.c
wildcard.h
x509asn1.c x509asn1: fix implicit-fallthrough warning with GCC 7 2017-06-03 20:10:52 +02:00
x509asn1.h