Mercurial > emacs
changeset 7525:5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 17 May 1994 09:43:47 +0000 |
parents | 66d8171f3d42 |
children | bf357bdc648e |
files | src/xfns.c |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xfns.c Tue May 17 09:05:25 1994 +0000 +++ b/src/xfns.c Tue May 17 09:43:47 1994 +0000 @@ -1322,7 +1322,26 @@ static void validate_x_resource_name () { - if (! STRINGP (Vx_resource_name)) + if (STRINGP (Vx_resource_name)) + { + int len = XSTRING (Vx_resource_name)->size; + unsigned char *p = XSTRING (Vx_resource_name)->data; + int i; + + /* Allow only letters, digits, - and _, + because those are all that X allows. */ + for (i = 0; i < len; i++) + { + int c = p[i]; + if (! ((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c >= '0' && c <= '9') + || c == '-' || c == '_')) + goto fail; + } + } + else + fail: Vx_resource_name = make_string ("emacs", 5); }