diff options
| author | Jim Meyering | 2009-06-09 05:57:35 +0000 |
|---|---|---|
| committer | Jim Meyering | 2009-06-09 05:57:35 +0000 |
| commit | 40aa3f13c674e5c78bb6c0e85de8f5f0ef3690a7 (patch) | |
| tree | 3f85141cdf4468a10dfa6323124530907a37f41d /src | |
| parent | 8c9d5f9f86b177497bcff5b41ebb51bf3cd9eadc (diff) | |
| download | emacs-40aa3f13c674e5c78bb6c0e85de8f5f0ef3690a7.tar.gz emacs-40aa3f13c674e5c78bb6c0e85de8f5f0ef3690a7.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xfaces.c | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 399faf60b47..5287bf704c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-06-09 Jim Meyering <meyering@redhat.com> | ||
| 2 | |||
| 3 | x-load-color-file: avoid array bounds error | ||
| 4 | x-load-color-file expects each line of input to be of the form | ||
| 5 | "R G B name". But if "name" is missing, it would read name[-1], | ||
| 6 | and if that value is '\n', zero it. | ||
| 7 | * xfaces.c (Fx_load_color_file): Handle missing color name. | ||
| 8 | |||
| 1 | 2009-06-09 Kenichi Handa <handa@m17n.org> | 9 | 2009-06-09 Kenichi Handa <handa@m17n.org> |
| 2 | 10 | ||
| 3 | * charset.c (Fmap_charset_chars): In docstring, state clearly that | 11 | * charset.c (Fmap_charset_chars): In docstring, state clearly that |
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. */) | |||
| 6630 | { | 6630 | { |
| 6631 | char *name = buf + num; | 6631 | char *name = buf + num; |
| 6632 | num = strlen (name) - 1; | 6632 | num = strlen (name) - 1; |
| 6633 | if (name[num] == '\n') | 6633 | if (num >= 0 && name[num] == '\n') |
| 6634 | name[num] = 0; | 6634 | name[num] = 0; |
| 6635 | cmap = Fcons (Fcons (build_string (name), | 6635 | cmap = Fcons (Fcons (build_string (name), |
| 6636 | #ifdef WINDOWSNT | 6636 | #ifdef WINDOWSNT |