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.
This commit is contained in:
Kyle Evans 2023-05-28 12:52:51 -05:00
parent 402cee1f19
commit e15da6b10a

View File

@ -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);