Author: theraven Date: Tue Nov 22 14:11:42 2011 New Revision: 227818 URL: http://svn.freebsd.org/changeset/base/227818
Log: Fix a crash when trying to duplicate a locale that contains some implicit C locale components. Reported by: Michael Butler Approved by: dim (mentor) Modified: head/lib/libc/locale/xlocale.c Modified: head/lib/libc/locale/xlocale.c ============================================================================== --- head/lib/libc/locale/xlocale.c Tue Nov 22 13:30:36 2011 (r227817) +++ head/lib/libc/locale/xlocale.c Tue Nov 22 14:11:42 2011 (r227818) @@ -200,8 +200,13 @@ static int dupcomponent(int type, locale if (new->components[type]) { strncpy(new->components[type]->locale, src->locale, ENCODING_LEN); } - } else { + } else if (base->components[type]) { new->components[type] = xlocale_retain(base->components[type]); + } else { + /* If the component was NULL, return success - if base is a valid + * locale then the flag indicating that this isn't present should be + * set. If it isn't a valid locale, then we're stuck anyway. */ + return 1; } return (0 != new->components[type]); } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"