mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
25da8085b3
look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file. In the first case, it also
added *menu to the memory_list; in the second case, it did not. The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.
However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.
To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>. Then make get_image_map() check the
return value instead of comparing pos to eof. And add a test case,
although not an automated one.
Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0. Then, the pos >= eof
comparison in get_image_map() would have been false. That scheme
would however have been a bit more difficult to understand and
maintain, I think.
Reported by Paul B. Mahol.
(cherry picked from commit
|
||
---|---|---|
config | ||
contrib | ||
doc | ||
po | ||
src | ||
test | ||
Unicode | ||
.gitignore | ||
.mailmap | ||
ABOUT-NLS | ||
AUTHORS | ||
autogen.sh | ||
BUGS | ||
ChangeLog | ||
configure.in | ||
COPYING | ||
features.conf | ||
INSTALL | ||
Makefile | ||
Makefile.config.in | ||
Makefile.lib | ||
NEWS | ||
README | ||
SITES | ||
THANKS | ||
TODO |
ELinks - an advanced web browser ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ELinks is an advanced and well-established feature-rich text mode web (HTTP/FTP/..) browser. ELinks can render both frames and tables, is highly customizable and can be extended via scripts. It is very portable and runs on a variety of platforms. The ELinks official website is available at http://elinks.cz/ Please see the SITES file for mirrors or other recommended sites. If you want to install ELinks on your computer, see the INSTALL file for further instructions. A good start point is documentation files available in doc/, especially the file named index.txt. If you want to request features or report bugs, see community information at http://elinks.cz/community.html and feedback information available at http://elinks.cz/feedback.html. If you want to write some patches, please first read the doc/hacking.txt document. If you want to add a new language or update the translation for an existing one, please read po/README document. If you want to write some documentation, well, you're welcome! ;) Historical notes ~~~~~~~~~~~~~~~~ Initially, ELinks was a development version of Links (Lynx-like text WWW browser), with more liberal features policy and development style. Its purpose was to provide an alternative to Links, and to test and tune various new features, but still provide good rock-solid releases inside stable branches. Why not contribute to Links instead? Well, first I made a bunch of patches for the original Links, but Mikulas wasn't around to integrate them, so I started releasing my fork. When he came back, a significant number of them got refused because Mikulas did not like them, as he just wouldn't have any use for them himself. He wants to keep Links with a relatively closed feature set and merge only new features which he himself needs. It has advantages that the tree is very narrow and the code is small and contains very little bloat. ELinks, on the contrary, aims to provide a full-featured web browser, superior to both lynx and w3m and with the power (but not slowness and memory usage) of Mozilla, Konqueror and similar browsers. However, to prevent drastic bloating of the code, the development is driven in the course of modularization and separation of add-on modules (like cookies, bookmarks, ssl, scripting etc). For more details about ELinks history, please see http://elinks.cz/history.html If you are more interested in the history and various Links clones and versions, you can examine the website at http://links.sf.net/ vim: textwidth=80