From: Ulrich Drepper Date: Fri, 29 May 1998 12:05:04 +0000 (+0000) Subject: (_nl_load_locale): Don't allow too small files crash the program. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=566e69afcda6640ede8a857fba3e48ba6f79b656;p=thirdparty%2Fglibc.git (_nl_load_locale): Don't allow too small files crash the program. --- diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 474a73cf6e3..83f976b79d7 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -1,5 +1,5 @@ /* Functions to read locale data files. -Copyright (C) 1996 Free Software Foundation, Inc. +Copyright (C) 1996, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -109,6 +109,9 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) if (__fstat (fd, &st) < 0) goto puntfd; } + else if (st.st_size < sizeof (*filedata)) + /* This cannot be a locale data file since it's too small. */ + goto puntfd; /* Map in the file's data. */ save_err = errno;