Mercurial > emacs
diff src/nsterm.m @ 106694:7874e9166ee3
Fix buffer overflow in ns_get_color.
* nsterm.m (ns_get_color): Fix buffer overflow (Bug#4763).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 01 Jan 2010 17:10:50 -0500 |
parents | bb413968898a |
children | 7a2c06c2f19c |
line wrap: on
line diff
--- 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 */