Commit Graph

2412 Commits

Author SHA1 Message Date
Tatsuya Kinoshita 25fb402cea Merge pull request #273 from rkta/bsoob
Fix OOB access due to multiple backspaces
2023-07-18 21:05:21 +09:00
Rene Kita edc602651c Fix OOB access due to multiple backspaces
Commit 419ca82d57 (Fix m17n backspace handling causes out-of-bounds
write in checkType) introduced an incomplete fix.

In function checkType we store the length of the previous multi-char
character in a buffer plens_buffer with pointer plens pointing to the
current position inside the buffer. When encountering a backspace plens
is set to the previous position without a bounds check. This will lead
to plens being out of bounds if we get more backspaces than we have
processed multi-char characters before.

If we are at the beginning of the buffer do not decrement and set plen
(the current length) to 0.

This also fixes GH Issue #270 [BUG] Out of bound read in Strnew_size ,
Str.c:61

If the above explanation does sound weird it's because I didn't fully
grok that function. :-)
2023-07-13 09:48:23 +02:00
Tatsuya Kinoshita 93ad5ee7da Update ChangeLog 2023-01-29 20:30:23 +09:00
Markus Hiereth 7728597236 Update German message catalogue
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1029933#5
2023-01-29 20:16:20 +09:00
Tatsuya Kinoshita c8223fed7c Update ChangeLog 2023-01-21 11:01:52 +09:00
Tatsuya Kinoshita 9f6c29399b Update NEWS to 0.5.3+git20230121 2023-01-21 11:01:01 +09:00
Tatsuya Kinoshita 760d7ad729 Update ChangeLog 2023-01-16 06:19:02 +09:00
Tatsuya Kinoshita c4862fd9c1 Add GROFF_NO_SGR=1 to w3mman2html.cgi for non-Debian groff
Bug-Debian: https://github.com/tats/w3m/pull/238
Bug-Debian: https://github.com/tats/w3m/issues/201
2023-01-16 06:08:57 +09:00
Tatsuya Kinoshita 7caad9ccf4 Revert "Turn ansi escape sequences into html tags"
This reverts commit 44af9271e0.
2023-01-16 06:08:11 +09:00
Tatsuya Kinoshita 8891eab5b5 Update ChangeLog 2023-01-12 22:15:43 +09:00
Tatsuya Kinoshita 2061fbfbc5 Do not expand config value of tmp_dir 2023-01-12 21:53:31 +09:00
Tatsuya Kinoshita 770ad50692 Update ChangeLog 2023-01-12 20:55:31 +09:00
Tatsuya Kinoshita 9a33001df0 Use faccessat for rc_dir and tmp_dir 2023-01-12 20:41:23 +09:00
Tatsuya Kinoshita baaaec0029 Allow writeLocalCookie even when no_rc_dir 2023-01-12 20:34:23 +09:00
Tatsuya Kinoshita d4e14f1b09 Call wtf_init in sync_with_option 2023-01-12 20:34:01 +09:00
Tatsuya Kinoshita 5ffce08c61 Avoid modifying read-only rc_dir 2023-01-12 19:39:10 +09:00
Tatsuya Kinoshita c9cbe79a61 Make tmp_dir if not found 2023-01-12 19:33:19 +09:00
Tatsuya Kinoshita 44ab1f73e3 Update ChangeLog 2023-01-09 19:23:42 +09:00
Tatsuya Kinoshita 9538c6d68a Prepare NEWS for w3m 0.5.3+git202301XX 2023-01-09 19:17:20 +09:00
Tatsuya Kinoshita e60d5bd19b Remove obsolete documents 2023-01-09 19:17:05 +09:00
Tatsuya Kinoshita 536f06da85 Wrap long lines to avoid Lintian warnings 2023-01-09 19:16:59 +09:00
Tatsuya Kinoshita 08fb05518f Update ChangeLog 2023-01-07 10:12:38 +09:00
Tatsuya Kinoshita b9c022a810 Only read a first title
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1020215
2023-01-07 09:57:51 +09:00
Tatsuya Kinoshita de325360b8 Revert "Only read title when in head"
This reverts commit 0189e8aa5c.
2023-01-07 09:24:03 +09:00
Tatsuya Kinoshita c985ae8727 Update ChangeLog 2023-01-07 00:32:02 +09:00
Tatsuya Kinoshita f00b565208 Indentation fix for HTMLtagproc1 2023-01-07 00:31:11 +09:00
Tatsuya Kinoshita cb29e944e6 Update ChangeLog 2023-01-06 23:54:47 +09:00
Robert Alm Nilsson 0189e8aa5c Only read title when in head
Before this change, it was possible that w3m would interpret a title tag
under e.g. an svg tag as the page title.
2023-01-06 23:36:06 +09:00
Tatsuya Kinoshita 54fb5fa186 Update ChangeLog 2023-01-06 19:44:13 +09:00
Tatsuya Kinoshita dbb708c56f Avoid locale sensitive tolower in wc_charset_to_ces 2023-01-06 19:42:04 +09:00
Sertaç Ö. Yıldız df0325c01e Fix charset declaration parser fails with turkish locale 2023-01-06 19:41:43 +09:00
Sertaç Ö. Yıldız 162d585f37 Use st_mtime instead of st_mtim.tv_sec to compile on macos 2023-01-06 19:41:36 +09:00
Tatsuya Kinoshita bbe2a76b5d Merge pull request #259 from rkta/dfn
Recognize link targets in dfn elements
2023-01-06 19:39:20 +09:00
Tatsuya Kinoshita 4ae311f02a Merge pull request #257 from rkta/failed_system_call
Handle failed system calls
2023-01-06 19:38:58 +09:00
Tatsuya Kinoshita 13e5c361cb Merge pull request #256 from rkta/softhyphen
Skip soft hyphen when reading token
2023-01-06 19:38:36 +09:00
Tatsuya Kinoshita d8b820d6cb Merge pull request #254 from rkta/check_lessopen
Check LESSOPEN to avoid undefined behaviour
2023-01-06 19:38:13 +09:00
Tatsuya Kinoshita 8cafc619c1 Update ChangeLog 2023-01-05 20:05:19 +09:00
Markus Hiereth 7ff3210f99 Update German message catalogue
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1011945#10
2023-01-05 20:03:29 +09:00
Rene Kita 07bccf3e36 Exit with error if a new buffer can't be allocated
When building with gcc and -Wnull-dereference, -O3 and -flto we get a
lot of warnings about potential null dereferences. Exiting instead of
returning NULL solves all of it.

If we cannot alloc memory, there is not much to do - exiting is the
easiest option.
2023-01-05 20:03:14 +09:00
Tatsuya Kinoshita 3750197410 Merge pull request #247 from rkta/hist
Do not override history file if it was changed
2023-01-05 20:02:07 +09:00
Tatsuya Kinoshita c56a66a93d Merge pull request #238 from albfan/w3mman
Turn ansi escape sequences into html tags
2023-01-05 20:01:30 +09:00
Rene Kita 4e23ee03ca Handle failed system calls
Introduce a separate TU for utility functions util.c. Add a function
exec_cmd to simplify execution of system commands with error handling.

While at it, suppress a warning about unused result when executing a
shell command. As we only display the command's output we do not care
about the exit code.

This fixes Debian bug #398989[0]

[0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398989
2023-01-04 13:59:49 +01:00
Rene Kita 7c7af9e70c Move declarations to appropiate header files
This is in preparation for the next patch.
2023-01-04 13:59:49 +01:00
Rene Kita da9722e3b7 Check LESSOPEN to avoid undefined behaviour
Like less, w3m can use an input preprocessor when displaying files. The
preprocessor command is taken from the environment variable LESSOPEN.
The command line in LESSOPEN should include one occurrence of the string
"%s", which will be replaced by the filename when the input preprocessor
command is invoked. Giving more than one "%s" - or a any other
conversion specifier - will lead to undefined behaviour.

Add a check to make sure the command given has only one "%s".

This fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991608
2023-01-04 13:59:13 +01:00
Rene Kita 8df395e7a2 Refactor lessopen_stream
Use early returns to spare a level of indentation.
2023-01-04 13:59:13 +01:00
Rene Kita c77029570d Merge history file if it was modified after start
w3m reads the history file on startup and writes it on exit. That means
if you open multiple instances of w3m, the history file will contain the
history of the last instance closed. All other history changes are lost.

Check if the modification time of the history file has changed before
writing. If it has changed read the history file from the disk into a
new history. Push the entries that are in the current history but not in
the history file into the new history and write the new history to disk.
2023-01-04 13:58:58 +01:00
Rene Kita e0c9a02784 Move declarations to the appropriate header file 2023-01-04 13:58:58 +01:00
Rene Kita 14c8274d16 Add comment to explain placement of the ifdef 2023-01-04 13:58:58 +01:00
Rene Kita f186e8331f Let loadHistory return an error code
This is in preparation for a following patch.
2023-01-04 13:58:58 +01:00
Rene Kita de813c322c Use 'goto fail' to remove code duplication 2023-01-04 13:58:58 +01:00