all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 34469@debbugs.gnu.org, Nicholas Drozd <nicholasdrozd@gmail.com>
Subject: bug#34469: 26.1; EWW stops renderring web page on null byte
Date: Tue, 19 Feb 2019 11:06:37 +0100	[thread overview]
Message-ID: <m2bm38drde.fsf@gmail.com> (raw)
In-Reply-To: <02sgwk1sza.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon, 18 Feb 2019 20:12:41 -0500")

Glenn Morris <rgm@gnu.org> writes:

> Perhaps eww-display-html should replace null bytes (with whatever the
> html standard says is appropriate) before calling
> libxml-parse-html-region. It already replaces CRLF.

Chrome at least just strips the null byte completely.

There is apparently a class of attacks that uses the null character
for nefarious purposes, so how about something like this:

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 1cc4557ce1..9b57bc43e4 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -448,8 +448,8 @@ eww-display-html
 		    (decode-coding-region (point) (point-max) encode)
 		  (coding-system-error nil))
                 (save-excursion
-                  ;; Remove CRLF before parsing.
-                  (while (re-search-forward "\r$" nil t)
+                  ;; Remove CRLF and NULL before parsing.
+                  (while (re-search-forward "\r$\\|\000" nil t)
                     (replace-match "" t t)))
 		(libxml-parse-html-region (point) (point-max))))))
 	(source (and (null document)





  reply	other threads:[~2019-02-19 10:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190213122718eucas1p26156656a2376e5055452ac4d0385fc6d@eucas1p2.samsung.com>
2019-02-13 12:27 ` bug#34469: 26.1; EWW stops renderring web page on null byte Lukasz Pawelczyk
2019-02-14  4:44   ` Nicholas Drozd
2019-02-14 19:14     ` Eli Zaretskii
2019-02-16 18:13   ` Nicholas Drozd
2019-02-19  1:12     ` Glenn Morris
2019-02-19 10:06       ` Robert Pluim [this message]
2019-02-19 16:30         ` Eli Zaretskii
2019-02-19 17:37           ` Robert Pluim
2019-02-19 18:11             ` Eli Zaretskii
2019-02-20 18:48               ` Robert Pluim
2019-02-27 11:31                 ` Robert Pluim
2019-02-27 15:55                   ` Eli Zaretskii
2019-02-27 16:21                     ` Robert Pluim
2019-02-28  1:52   ` Paul Eggert
2019-02-28  8:46     ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2bm38drde.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=34469@debbugs.gnu.org \
    --cc=nicholasdrozd@gmail.com \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.