diff src/process.c @ 76789:e3f8914e3f5e

(Fformat_network_address): Return nil when the argument vector contains invalid values.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 29 Mar 2007 13:55:48 +0000
parents c21bd0559ef9
children fbe60d04cec2
line wrap: on
line diff
--- a/src/process.c	Thu Mar 29 09:37:36 2007 +0000
+++ b/src/process.c	Thu Mar 29 13:55:48 2007 +0000
@@ -1295,7 +1295,20 @@
 	return Qnil;
 
       for (i = 0; i < nargs; i++)
-	args[i+1] = p->contents[i];
+	{
+	  EMACS_INT element = XINT (p->contents[i]);
+
+	  if (element < 0 || element > 65535)
+	    return Qnil;
+
+	  if (nargs <= 5         /* IPv4 */
+	      && i < 4           /* host, not port */
+	      && element > 255)
+	    return Qnil;
+
+	  args[i+1] = p->contents[i];
+	}
+
       return Fformat (nargs+1, args);
     }
 
@@ -1410,7 +1423,6 @@
       if (CONSP (p->status))
 	symbol = XCAR (p->status);
 
-
       if (EQ (symbol, Qsignal))
 	{
 	  Lisp_Object tem;