Commit Graph

24 Commits

Author SHA1 Message Date
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
Rene Kita
e8287f36b0 Skip soft hyphen when reading token
The soft hyphen should only appear if a word is broken at the hyphen
position. Filter it out.

Adjust the entity test files to reflect the new behaviour.

This fixes Issue #224 and Debian Bug #830173.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=830173
Bug-Debian: https://github.com/tats/w3m/issues/224
2023-01-04 13:58:10 +01:00
Tatsuya Kinoshita
dff69f1281 Merge pull request #219 from rkta/add_option_for_temp_files
Add option to set directory for temporary files
2022-12-21 20:20:27 +09:00
Tatsuya Kinoshita
4d813002c3 Fix potential overflow in checkType 2022-12-20 21:16:53 +09:00
Tatsuya Kinoshita
419ca82d57 Fix m17n backspace handling causes out-of-bounds write in checkType
[CVE-2022-38223]
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019599
Bug-Debian: https://github.com/tats/w3m/issues/242
2022-12-20 21:16:48 +09:00
Rene Kita
9192ed59db Add option to set directory for temporary files
With this patch applied the user can configure a directory to store
temporary/cache files. The history and cookies remain in RC_DIR.

I suppose the intent of writing the history to a temp file first is to
make the actual write an atomic operation. As rename() does not work
across mount points, we need to handle the temp file for the history
different to keep this behaviour.

Add a new type for the temp history file and handle this case different
when creating a temp file.
2022-05-01 11:50:09 +02:00
Rene Kita
a0b3c1b467 Fix potential null dereference 2022-04-19 10:08:54 +02:00
Rene Kita
cf7058b56c Let base64_encode() take a char *
Throughout the whole code base only char * is passed, but a unsigned
char * is expected. This leads to several warnings.

Fix the interface and cast to unsigned char * internally to avoid any
changes to the behaviour.
2022-02-20 11:14:54 +01:00
Rene Kita
4901408ea5 Fix warning for unused variable without USE_M17N 2022-02-20 11:14:53 +01:00
Tatsuya Kinoshita
59ea885da0 Treat 127.0.0.1, [::1], and hostname as localhost 2021-04-23 20:16:50 +09:00
Tatsuya Kinoshita
99d11d347c Use Strcatc and Strnulterm in base64_encode 2021-04-05 22:37:33 +09:00
bptato
694a10271d Return Str from base64_encode, fix extraction of first gif frame for animations in put_image_kitty 2021-04-04 17:57:13 +02:00
bptato
3304675aff Support kitty image protocol 2021-02-18 19:18:06 +01:00
bptato
de26f6156c Handle iTerm2 images more efficiently 2021-02-18 17:23:42 +01:00
bptato
1a47d07d66 Use GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE for allocating memory for base64 encoding 2021-02-03 13:03:52 +01:00
bptato
5cd5a1735a base64_encode: fix input and output length types 2021-02-03 10:41:20 +01:00
bptato
d277e80771 Some cleanup for base64_encode 2021-02-02 23:59:42 +01:00
bptato
e4570e8b6e Support iTerm2 graphics protocol, replace encodeB with base64_encode 2021-02-02 22:14:46 +01:00
Parag Nemade
f1fd7215d2 Fix FTBFS due to redefinition of sys_errlist
Origin: 99f30870ca
Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1038009
Bug-MacPorts: https://trac.macports.org/ticket/61356
2020-11-22 21:13:27 +09:00
Ambrose Li
48c9ec565d In HTML5 anchors should not be closed when encountering divs, for example, but should be closed when encountering buttons, for example. Many sites that use HTML5-style anchors end up having links displayed with zero-length link texts. The proposed patch correct this behaviour by detecting whether the document is HTML5, then suppressing the close-anchor action in CLOSE_A if it's an HTML5 document. A new macro handles the HTML5-specific cases where anchors are not already always closed.
This also fixes a bug in the tokenizing FSM in etc.c that prevented the !doctype element from being recognized; the fix is necessary because HTML5 detection depends on checking the !doctype element.
2020-08-24 23:48:09 -04:00
Tatsuya Kinoshita
1978455e2e Prevent negative array index for realColumn in calcPosition()
Bug-Debian: https://github.com/tats/w3m/issues/69
2016-12-10 22:30:36 +09:00
Araki Ken
09ececc3b7 Remove close_tty() from setup_child() because close_tty() sometimes interrupts loadGeneralFile() in loadImage() and corrupt image data can be cached in ~/.w3m. 2014-12-06 20:47:05 +09:00
Tatsuya Kinoshita
6db339b3d7 Adding upstream version 0.5.2 2011-05-04 16:23:02 +09:00
Tatsuya Kinoshita
72f72d64a4 Adding upstream version 0.5.1 2011-05-04 16:05:14 +09:00