increase limit on locale name length from 15 to 23 bytes

the old limit was one byte too short to support locale names of the
form xx_XX.UTF-8@modifier where modifier is more than 3 bytes, a form
which various real-world locale names take. the problem could be
avoided by omitting the useless ".UTF-8" part, but users may need to
have it present when operating on mixed-libc systems or when it will
be carried over (e.g. across ssh) to other systems.

the new limit is chosen sufficient for existing/reasonable locale
names while still keeping the size of setlocale's static buffer small.

also add locale_impl.h to the Makefile's list of headers which force
rebuild of source files, to prevent dangerously inconsistent object
files from getting used after this change.
This commit is contained in:
Rich Felker 2017-03-21 12:13:59 -04:00
parent e4fc9ad780
commit e6917eced2
2 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ AOBJS = $(LIBC_OBJS)
LOBJS = $(LIBC_OBJS:.o=.lo) LOBJS = $(LIBC_OBJS:.o=.lo)
GENH = obj/include/bits/alltypes.h obj/include/bits/syscall.h GENH = obj/include/bits/alltypes.h obj/include/bits/syscall.h
GENH_INT = obj/src/internal/version.h GENH_INT = obj/src/internal/version.h
IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h) IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/locale_impl.h src/internal/libc.h)
LDFLAGS = LDFLAGS =
LDFLAGS_AUTO = LDFLAGS_AUTO =

View File

@ -6,7 +6,7 @@
#include "libc.h" #include "libc.h"
#include "pthread_impl.h" #include "pthread_impl.h"
#define LOCALE_NAME_MAX 15 #define LOCALE_NAME_MAX 23
struct __locale_map { struct __locale_map {
const void *map; const void *map;