From 35f1de62f2ab87e39c4a058cb34668727e9a9c42 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sun, 21 Nov 2010 13:16:19 -0500 Subject: [PATCH] * editfns.c (Fbyte_to_string): Signal an error if arg is not a byte. --- src/ChangeLog | 4 ++++ src/editfns.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4655ea714ad..f986c03cc14 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-21 Chong Yidong + + * editfns.c (Fbyte_to_string): Signal an error arg is not a byte. + 2010-11-20 Jan Djärv * gtkutil.c (menubar_map_cb): New function (Bug#7425). diff --git a/src/editfns.c b/src/editfns.c index ea279a462f2..910fd13aed4 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -222,12 +222,14 @@ usage: (char-to-string CHAR) */) } 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); } -- 2.39.2