From e15da6b10a4971f43aa604fca3ea43effa096f4c Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sun, 28 May 2023 12:52:51 -0500 Subject: [PATCH] libc: locale: fix collation file size validation At a minimum, we need enough for the colllation format version string + locale definition version string and a full collate_info definition, rather than just the first two and a pointer. Sponsored by: Klara, Inc. --- lib/libc/locale/collate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index 8360c62badd4..c4e7d1cddba1 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -159,7 +159,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table) } if (sbuf.st_size < (COLLATE_FMT_VERSION_LEN + XLOCALE_DEF_VERSION_LEN + - sizeof (info))) { + sizeof (*info))) { (void) _close(fd); errno = EINVAL; return (_LDP_ERROR);