GNU bug report logs - #13706
24.3.50; network-stream-command may return nil, not always a string

Previous Next

Package: emacs;

Reported by: Didier Verna <didier <at> didierverna.net>

Date: Wed, 13 Feb 2013 10:33:01 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Didier Verna <didier <at> didierverna.net>
To: 13706 <at> debbugs.gnu.org
Cc: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Subject: bug#13706: 24.3.50; network-stream-command may return nil, not always a string
Date: Wed, 13 Feb 2013 10:54:27 +0100
[Message part 1 (text/plain, inline)]
network-stream-get-response returns nil if the server connection is
lost, hence network-stream-command does the same. There was one instance
of a blind string-match against the return value which would fail with a
STRINGP NIL error from time to time.

The attached patch fixes this.

2013-02-13  Didier Verna  <didier <at> didierverna.net>

	* net/network-stream.el (network-stream-open-starttls): Check that
	the response to the starttls-command is not nil before
	string-match'ing it.


[diff.patch (text/plain, inline)]
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index 8cf9ec6..fd21997 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -262,8 +262,9 @@ STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality.
 	;; EHLO for SMTP.
 	(when (plist-get parameters :always-query-capabilities)
 	  (network-stream-command stream capability-command eo-capa)))
-      (when (string-match success-string
-			  (network-stream-command stream starttls-command eoc))
+      (when (let ((response
+		   (network-stream-command stream starttls-command eoc)))
+	      (and response (string-match success-string response)))
 	;; The server said it was OK to begin STARTTLS negotiations.
 	(if builtin-starttls
 	    (let ((cert (network-stream-certificate host service parameters)))
[Message part 3 (text/plain, inline)]

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

EPITA/LRDE, 14-16 rue Voltaire, 94276 Le Kremlin-BicĒtre, France
Tel. +33 (0)1 44 08 01 85       Fax. +33 (0)1 53 14 59 22

This bug report was last modified 12 years and 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.