unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: me--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 61411@debbugs.gnu.org
Subject: bug#61411: [PATCH] Handle a case where url-basic-auth can crash
Date: Sat, 11 Feb 2023 07:43:10 +0000	[thread overview]
Message-ID: <c847e5c84c3ae4af9f864e4fb54fa399@elken.dev> (raw)

[-- Attachment #1: Type: text/plain, Size: 341 bytes --]

Hi all,

This seems like a simple patch, in cases where 
'url-request-noninteractive' is set and valid credentials either aren't 
found or the server sends 401 regardless (which is how I found this 
bug), this causes Emacs to crash.

I have copyright assignment assigned, even though this would fall under 
a "trivial change".

Thanks,
Ellis

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-potential-crash-with-url-basic-auth.patch --]
[-- Type: text/x-diff; name=0001-Fix-potential-crash-with-url-basic-auth.patch, Size: 943 bytes --]

From c35eddf8bc938ccfa0d9a55fc6f142595bc2de15 Mon Sep 17 00:00:00 2001
From: Ellis Kenyo <me@elken.dev>
Date: Sat, 11 Feb 2023 07:27:56 +0000
Subject: [PATCH] Fix potential crash with url-basic-auth

* lisp/url/url-auth.el (url-basic-auth):
Handle a case where Emacs would crash where no valid credentials are found
and 'url-request-noninteractive' is t
---
 lisp/url/url-auth.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index e9ee72029f..83b4fa6468 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -100,7 +100,7 @@ instead of the filename inheritance method."
 			     (setq retval
 				   (base64-encode-string
 				    (format "%s:%s" user
-					    (encode-coding-string pass 'utf-8))
+					    (encode-coding-string (or pass "") 'utf-8))
                                     t))))
 		 (symbol-value url-basic-auth-storage))))
      (byserv
-- 
2.39.0


             reply	other threads:[~2023-02-11  7:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11  7:43 me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-02-25 21:36 ` bug#61411: [PATCH] Handle a case where url-basic-auth can crash me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-26  5:29   ` Eli Zaretskii
2023-02-26  8:52     ` me--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-02 12:37       ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=c847e5c84c3ae4af9f864e4fb54fa399@elken.dev \
    --to=bug-gnu-emacs@gnu.org \
    --cc=61411@debbugs.gnu.org \
    --cc=me@elken.dev \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).