7 Bug-Reported-by: <romerox.adrian@gmail.com>
8 Bug-Reference-ID: <CABV5r3zhPXmSKUe9uedeGc5YFBM2njJ1iVmY2h5neWdQpDBQug@mail.gmail.com>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-08/msg00045.html
13 A locale with a long name can trigger a buffer overflow and core dump. This
14 applies on systems that do not have locale_charset in libc, are not using
15 GNU libiconv, and are not using the libintl that ships with bash in lib/intl.
17 Patch (apply with `patch -p0'):
19 --- a/lib/sh/unicode.c
20 +++ b/lib/sh/unicode.c
21 @@ -78,13 +78,15 @@ stub_charset ()
22 s = strrchr (locale, '.');
25 - strcpy (charsetbuf, s+1);
26 + strncpy (charsetbuf, s+1, sizeof (charsetbuf) - 1);
27 + charsetbuf[sizeof (charsetbuf) - 1] = '\0';
28 t = strchr (charsetbuf, '@');
33 - strcpy (charsetbuf, locale);
34 + strncpy (charsetbuf, locale, sizeof (charsetbuf) - 1);
35 + charsetbuf[sizeof (charsetbuf) - 1] = '\0';
42 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
43 looks for to find the patch level (for the sccs version string). */
45 -#define PATCHLEVEL 34
46 +#define PATCHLEVEL 35
48 #endif /* _PATCHLEVEL_H_ */