# HG changeset patch # User Chong Yidong # Date 1262383850 18000 # Node ID 7874e9166ee38d396ea793ef2d731bf0610c7181 # Parent 5240a1bf44bcac4d20a13f6311d53a45de618dab Fix buffer overflow in ns_get_color. * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763). diff -r 5240a1bf44bc -r 7874e9166ee3 src/ChangeLog --- a/src/ChangeLog Fri Jan 01 15:42:22 2010 -0500 +++ b/src/ChangeLog Fri Jan 01 17:10:50 2010 -0500 @@ -1,5 +1,7 @@ 2010-01-01 Chong Yidong + * nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763). + * lread.c (syms_of_lread): Make it clearer that these are the names of loaded files (Bug#5068). diff -r 5240a1bf44bc -r 7874e9166ee3 src/nsterm.m --- a/src/nsterm.m Fri Jan 01 15:42:22 2010 -0500 +++ b/src/nsterm.m Fri Jan 01 17:10:50 2010 -0500 @@ -1346,7 +1346,8 @@ } else if (!strncmp(name, "rgb:", 4)) /* A newer X11 format -- rgb:r/g/b */ { - strcpy(hex, name + 4); + strncpy (hex, name + 4, 19); + hex[19] = '\0'; scaling = (strlen(hex) - 2) / 3; } else if (name[0] == '#') /* An old X11 format; convert to newer */