git: a977fb7c841a - stable/13 - libc: locale: fix collation file size validation

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Wed, 21 Jun 2023 02:39:35 UTC
The branch stable/13 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=a977fb7c841a4e4b87ab8c94d48d0e342aa47014

commit a977fb7c841a4e4b87ab8c94d48d0e342aa47014
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-05-28 17:52:51 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-06-20 20:11:48 +0000

    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.
    
    (cherry picked from commit e15da6b10a4971f43aa604fca3ea43effa096f4c)
---
 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 2f0e2003aa45..c3b66e1f0534 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -148,7 +148,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);