Commit Graph

2538 Commits

Author SHA1 Message Date
Tim Rühsen
ce8ce5bfc0 * src/progress.c: Allow const names for set_progress_implementation. 2019-12-27 13:42:30 +01:00
Tim Rühsen
61b8078672 * src/progress.c (dot_draw): Avoid integer overflow 2019-12-27 13:42:01 +01:00
Tim Rühsen
abe1ab1916 * src/progress.c (print_row_stats): Fix UB if eta < 0 2019-12-27 13:41:01 +01:00
Tim Rühsen
542524855a * src/progress.c (dot_update, dot_finish): Sanitize input 2019-12-27 13:40:52 +01:00
Tim Rühsen
f5d1dcf718 * src/retr.c (calc_rate): Fix division by 0 2019-12-27 13:40:33 +01:00
Tim Rühsen
1c1cba3a43 * src/retr.c (calc_rate): Add TB/s 2019-12-27 13:39:55 +01:00
Tim Rühsen
0179138fe5 * src/progress.c (create_image): Sanitize input param 'dl_total_time' 2019-12-27 13:39:50 +01:00
Lauri Nurmi
dd710bde96 Mark note to translators properly and elaborate its contents.
* src/progress.c (create_image): Likewise

The note was not even picked by xgettext to be included in the .pot,
so barely any translators even saw the note.
Also, this is one of the most cryptic messages to translate in wget,
unless the translator happens to guess where the string is used,
or looks at the source.

Copyright-paperwork-exempt: Yes
2019-12-26 19:02:36 +01:00
Lauri Nurmi
dc8bbdbb05 * src/main.c (print_help): Don't cut translatable string mid-sentence.
Complicates translating.

Copyright-paperwork-exempt: Yes
2019-12-26 19:00:11 +01:00
Tim Rühsen
96d74948a3 * src/Makefile.am: Add build_info.c to EXTRA_DIST 2019-11-21 12:16:28 +01:00
Tim Rühsen
feb52bfab7 * src/ftp.c (delelement): Make sure free'd pointer is set to NULL 2019-11-21 10:56:10 +01:00
Tim Rühsen
2ba8da8f22 Replace XDIGIT_TO_NUM by _unhex() with proper unsigned handling
* src/wget.h: Replace XDIGIT_TO_NUM by _unhex()
* src/html-parse.c (decode_entity): Use _unhex()
* src/host.c (is_valid_ipv6_address): Use _unhex()
* src/url.c (url_unescape_1): Use unsigned char to avoid UB
* src/res.c (free_specs): Likewise

Code taken from Wget2. XDIGIT_TO_NUM had a signed issue, detected by
scan-build static anylyzer.
2019-11-21 10:56:10 +01:00
Tim Rühsen
a255d9f0c8 * src/connect.c (select_fd): Check for negative fd 2019-11-21 10:56:10 +01:00
Tim Rühsen
6f3baab02c * src/cookie.c: Fix cookie file header to be recognized by 'file' 2019-11-19 12:37:46 +01:00
Darshit Shah
60dc09b507 Revert " Hi, Thank you again Darshit for your response. The RejectHeaderField rule rejects ANY header"
I accidentally commited this patch.

This reverts commit 4ce2f93600.
2019-05-30 11:19:46 +02:00
sulfastor
4ce2f93600 Hi, Thank you again Darshit for your response. The RejectHeaderField rule rejects ANY header
of the header field while RejectHeader rejects ONLY the specified full header.
	Since we wanted to be sure a header field is not sent to the server we wrote this rule.

	* doc/wget.texi: Added --disable-header documentation.
        * fuzz/wget_options_fuzzer.dict: Update with --disable-header inputs.
        * src/http.c (disabled_header): Checks for disabled headers
	(request_set_header): Doesn't let header to be set if disabled
	(gethttp): frees disabled header to let overriding
        * src/init.c (cmd_dis_header), (check_user_disabled_header) added new option disabled_headers.
        * src/main.c: added new option --disable-header, added help description
        * src/options.h: added new option --disable-header
	* src/utils.h (vec_remove_header)
	* src/utils.c (vec_remove_header) removes all header instances from vector
        * testenv/Makefile.am: Added new test files
        * testenv/server/http/http_server.py: Added new rule RejectHeaderField
        * testenv/conf/reject_header_field.py: Added new rule RejectHeaderField
        * testenv/README: Added help description for new rule
        * testenv/Test-disable-default-headers.py: Test without using --header
        * testenv/Test-disable-headers-after.py: Test using --header before --disable-header
        * testenv/Test-disable-headers-before.py: Test using --header after --disable-header

Signed-off-by: sulfastor <torresmoisesa@gmail.com>, adham elkarn <adhamelkarn@hotmail.com>
2019-05-30 10:01:24 +02:00
Tim Rühsen
0cdbc715a9 * src/log.c (log_vprintf_internal): Don't log twice 2019-05-28 16:26:03 +02:00
AviSoomirtee
95a677c7f5 * src/openssl.c (ssl_init): post handshake auth for OpenSSL
Copyright-paperwork-exempt: Yes
2019-05-25 18:10:37 +02:00
Tim Rühsen
95de9cd97f * src/convert.c (convert_basename): Do not pass NULL to strrchr() 2019-05-07 17:06:04 +02:00
Tim Rühsen
fac8f8099d * src/url.c (append_uri_pathel): Check for possible NULL dereference 2019-05-07 17:05:55 +02:00
Tim Rühsen
94e2dd5ecd Add --enable-manywarnings from wget2
* .gitignore: Exclude /lib/Makefile.am
* bootstrap.conf: Use --makefile-name=gnulib.mk with gnulib-tool
* configure.ac: Use wget_MANYWARNINGS()
* lib/Makefile.am: Define empty noinst_LIBRARIES and MAINTAINERCLEANFILES
* m4/wget_manywarnings.m4: New file from GNU Wget2
* src/Makefile.am: Use WARN_CFLAGS for AM_CFLAGS
2019-05-02 12:53:19 +02:00
Eneas U de Queiroz
14e3712b8c * src/openssl.c: fix ssl_init for openssl 1.1.1
ssl_init fails with openssl 1.1.1 when openssl.cnf is not found.
Redundant calls to intialization functions were removed as
OPENSSL_config takes care of them for openssl versions < 1.1.0.
For versions > 1.1.0, OPENSSL_init_ssl is preferred.

Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
Copyright-paperwork-exempt: Yes
2019-04-26 10:33:49 +02:00
raminfp
4574771a6a [log] miss check If logging is inhibited 2019-04-11 08:50:42 +00:00
Tim Rühsen
562eacb76a * src/iri.c (do_conversion): Remove unneeded debug lines 2019-04-05 13:01:57 +02:00
Tim Ruehsen
692d5c5215 Fix a buffer overflow vulnerability
* src/iri.c(do_conversion): Reallocate the output buffer to a larger
  size if it is already full
2019-04-05 11:54:30 +02:00
Tim Rühsen
0eaa5f1771 * src/openssl.c (ssl_init): Check for X509_V_FLAG_PARTIAL_CHAIN 2019-04-03 14:54:45 +02:00
Tim Rühsen
5d87635c66 Fix corner case in processing server response
* src/http.c (response_head_terminator): Don't access uninitialized data
* fuzz/wget_read_hunk_fuzzer.c: Sync response_head_terminator()
2019-03-25 16:05:56 +01:00
Tim Rühsen
4046cd2a71 Add new fuzzer wget_read_hunk_fuzzer.c
* fuzz/Makefile.am: Add wget_read_hunk_fuzzer
* fuzz/wget_read_hunk_fuzzer.c: New file
* fuzz/wget_read_hunk_fuzzer.in/*: Fuzz corpora
* src/connect.c: Add connect_cleanup()
* src/connect.h: Add prototype for connect_cleanup()
2019-03-25 14:57:07 +01:00
Jeffrey Walton
7c1c8eb3b1 * src/openssl.c (ssl_init): Trust partial cert chain 2019-02-22 12:46:53 +01:00
Tim Rühsen
19661f1d9a * src/ftp-ls.c (ftp_parse_vms_ls): Use snprintf instead of strcpy/strcat 2019-02-20 10:32:47 +01:00
Darshit Shah
e39be32838 * src/html-url.c(get_urls_html_fm): Add message in verbose mode with no-follow attribute 2019-02-19 23:25:05 +01:00
Darshit Shah
8b975e83d3 Update copyright statements 2019-02-10 11:50:17 +01:00
Leon Klingele
9e7c1554bd docs: --no-cache also sets the 'Cache-Control: no-cache' header
* doc/wget.texi: Add Cache-Control to docs
* src/wget.h: Add Cache-Control to comment of SEND_NOCACHE

Copyright-paperwork-exempt: Yes
2019-01-23 22:04:01 +01:00
Tim Rühsen
f1eda916a6 * src/init.c (cleanup): Check HAVE_HSTS
Reported-by: Simon Dales
2019-01-20 19:42:53 +01:00
André Wolski
5dceb6626b NTLM restart authentication (trivial change)
* src/http-ntlm.c (ntlm_input): Continue on NTLMSTATE_LAST,
  error on NTLMSTATE_TYPE3

The code comes from the cURL project. Thanks to Daniel Stenberg
for donating the code.

https://lists.gnu.org/archive/html/bug-wget/2018-12/msg00030.html
2018-12-31 10:24:27 +01:00
Tim Rühsen
fdb7fe613c Fix typos detected by codespell (via contrib/spell-checker) 2018-12-28 18:58:15 +01:00
Tim Rühsen
6ba1cb587c * src/wget.h: #undef _Noreturn when building with C++ 2018-12-27 20:47:58 +01:00
Tim Rühsen
5811c2222b * src/gnutls.c (ssl_connect_wget): Fix call to gnutls_set_default_priority() 2018-12-27 20:46:55 +01:00
Tim Rühsen
3cdfb594cf Don't save user/pw with --xattr
Also the Referer info is reduced to scheme+host+port.

* src/ftp.c (getftp): Change params of set_file_metadata()
* src/http.c (gethttp): Change params of set_file_metadata()
* src/xattr.c (set_file_metadata): Remove user/password from origin URL,
  reduce Referer value to scheme/host/port.
* src/xattr.h: Change prototype of set_file_metadata()
2018-12-26 14:38:24 +01:00
Tim Rühsen
c125d24762 Don't use extended attributes (--xattr) by default
* src/init.c (defaults): Set enable_xattr to false by default
* src/main.c (print_help): Reverse option logic of --xattr
* doc/wget.texi: Add description for --xattr

Users may not be aware that the origin URL and Referer are saved
including credentials, and possibly access tokens within
the urls.
2018-12-26 14:06:38 +01:00
Jay Satiro
61271d87f6 * src/init.c: Stop freeing the pointer returned by ws_mypath()
.. since ws_mypath() saves the address it returns in a static pointer
for reuse, to also be returned in later calls.
2018-11-13 15:51:51 +01:00
Darshit Shah
2bc2d2f803 * src/ftp.c(ftp_retrieve_glob): Honor {accept,reject}-regex switches as well 2018-11-13 15:51:51 +01:00
Darshit Shah
8c741da256 * src/ftp.c (ftp_retrieve_glob): Refactor to prevent looping over listing multiple times 2018-11-13 15:51:51 +01:00
Tim Rühsen
11fad3fa72 Revert "Bail out on unexpected 416 server errors"
This reverts commit 6f3b995993.

The code is obviously wrong, see https://savannah.gnu.org/bugs/?54963
Also, the example from the original post doesn't work any more.
With other words, the broken server behavior has been fixed meanwhile.
2018-11-09 16:16:43 +01:00
Rosen Penev
a3643c6076 openssl: Do not use engines when OpenSSL does not support
* src/openssl.c: Check for OPENSSL_NO_ENGINE before
 including openssl/engine.h and before calling ENGINE_load_builtin_engines()

Fixes compilation with no engines compiled.

Copyright-paperwork-exempt: Yes
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2018-11-09 16:01:51 +01:00
Kapus, Timotej
6d7cd9313c Replace some loops with string.h functions
* src/init.c: Replace loop with strspn
* src/url.c: Replace loop with strrchr

Copyright-paperwork-exempt: Yes
2018-10-28 10:36:46 +01:00
Luiz Angelo Daros de Luca
fd85ac9cc6 * src/host.c (sufmatch): Fix dot-prefixed domain matching
Current sufmatch does not match when domain is dot-prefixed.
The example of no_proxy in man (.mit.edu) does use a dot-prefixed
domain.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Copyright-paperwork-exempt: Yes
2018-10-26 22:54:26 +02:00
Tim Rühsen
21daa24e72 * src/convert.c (convert_links): Fix fallthrough 2018-10-26 22:52:41 +02:00
Nikos Mavrogiannopoulos
c11cc83d9e Enable post-handshake auth under gnutls on TLS1.3 2018-10-08 15:55:48 +02:00
Tim Rühsen
0727b8f3a9 * src/http.c (resp_new): Fix code to avoid false positive by clang 2018-09-20 14:59:06 +02:00