# HG changeset patch # User Jim Meyering # Date 1244527055 0 # Node ID eb941fcd33b402d3bfde21a34923fd573c2e7a1d # Parent 43008904e5da6dead7c1617c645aca078e2feebb 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. diff -r 43008904e5da -r eb941fcd33b4 src/ChangeLog --- a/src/ChangeLog Tue Jun 09 03:44:48 2009 +0000 +++ b/src/ChangeLog Tue Jun 09 05:57:35 2009 +0000 @@ -1,3 +1,11 @@ +2009-06-09 Jim Meyering + + 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. + 2009-06-09 Kenichi Handa * charset.c (Fmap_charset_chars): In docstring, state clearly that diff -r 43008904e5da -r eb941fcd33b4 src/xfaces.c --- a/src/xfaces.c Tue Jun 09 03:44:48 2009 +0000 +++ b/src/xfaces.c Tue Jun 09 05:57:35 2009 +0000 @@ -6630,7 +6630,7 @@ { 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