]> git.eshelyaron.com Git - emacs.git/commitdiff
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
authorRichard M. Stallman <rms@gnu.org>
Tue, 17 May 1994 09:43:47 +0000 (09:43 +0000)
committerRichard M. Stallman <rms@gnu.org>
Tue, 17 May 1994 09:43:47 +0000 (09:43 +0000)
src/xfns.c

index c0313b20b0116955d0ca8d35a3df31190c928091..5fc2ac650ca652e7f4cfc1ea3651d0664fdfd2fc 100644 (file)
@@ -1322,7 +1322,26 @@ x_set_vertical_scroll_bars (f, arg, oldval)
 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);
 }