diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-05-29 12:05:04 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-05-29 12:05:04 +0000 |
commit | 566e69afcda6640ede8a857fba3e48ba6f79b656 (patch) | |
tree | 55cb1ff353096958827961b004f457d5f0c5f588 | |
parent | 62d65f6998b894ec28b1061a000998abe2994149 (diff) | |
download | glibc-566e69afcda6640ede8a857fba3e48ba6f79b656.tar.gz glibc-566e69afcda6640ede8a857fba3e48ba6f79b656.tar.xz glibc-566e69afcda6640ede8a857fba3e48ba6f79b656.zip |
(_nl_load_locale): Don't allow too small files crash the program.
-rw-r--r-- | locale/loadlocale.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 474a73cf6e..83f976b79d 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 <drepper@gnu.ai.mit.edu>, 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; |