diff src/editfns.c @ 111756:0e4f6aed76c8

* editfns.c (Fbyte_to_string): Signal an error if arg is not a byte.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 21 Nov 2010 13:16:19 -0500
parents 7a086283ef8c
children 141d3f14d8c3 376148b31b5e
line wrap: on
line diff
--- a/src/editfns.c	Sun Nov 21 13:07:47 2010 -0500
+++ b/src/editfns.c	Sun Nov 21 13:16:19 2010 -0500
@@ -222,12 +222,14 @@
 }
 
 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
-       doc: /* Convert arg BYTE to a string containing that byte.  */)
+       doc: /* Convert arg BYTE to a unibyte string containing that byte.  */)
      (byte)
      Lisp_Object byte;
 {
   unsigned char b;
   CHECK_NUMBER (byte);
+  if (XINT (byte) < 0 || XINT (byte) > 255)
+    error ("Invalid byte");
   b = XINT (byte);
   return make_string_from_bytes (&b, 1, 1);
 }