diff options
author | Jim Meyering <jim@meyering.net> | 2009-06-09 05:57:35 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2009-06-09 05:57:35 +0000 |
commit | 40aa3f13c674e5c78bb6c0e85de8f5f0ef3690a7 (patch) | |
tree | 3f85141cdf4468a10dfa6323124530907a37f41d /src/xfaces.c | |
parent | 8c9d5f9f86b177497bcff5b41ebb51bf3cd9eadc (diff) | |
download | emacs-40aa3f13c674e5c78bb6c0e85de8f5f0ef3690a7.tar.gz |
x-load-color-file: avoid array bounds error
x-load-color-file expects each line of input to be of the form
"R G B name". But if "name" is missing, it would read name[-1],
and if that value is '\n', zero it.
* xfaces.c (Fx_load_color_file): Handle missing color name.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r-- | src/xfaces.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index 444376838b9..704d7a92049 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6630,7 +6630,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) { char *name = buf + num; num = strlen (name) - 1; - if (name[num] == '\n') + if (num >= 0 && name[num] == '\n') name[num] = 0; cmap = Fcons (Fcons (build_string (name), #ifdef WINDOWSNT |