changeset 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 e61b4b61e220
children b7f5870e3ec1
files src/process.c
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
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;