Skip to content

Commit eae0bc4

Browse files
MAX_ENCODING_SIZE -> MAX_CP_LEN
1 parent 3031948 commit eae0bc4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/_localemodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ copy_grouping(const char* s)
8989

9090
#if defined(MS_WINDOWS)
9191

92-
// The number of elements in the szCodePage field
92+
// 16 is the number of elements in the szCodePage field
9393
// of the __crt_locale_strings structure.
94-
#define MAX_ENCODING_SIZE 16
94+
#define MAX_CP_LEN 15
9595

9696
static int
9797
check_locale_name(const char *locale, const char *end)
9898
{
9999
size_t len = end ? (size_t)(end - locale) : strlen(locale);
100100
const char *dot = memchr(locale, '.', len);
101-
if (dot && locale + len - dot > MAX_ENCODING_SIZE) {
101+
if (dot && locale + len - dot - 1 > MAX_CP_LEN) {
102102
return -1;
103103
}
104104
return 0;

0 commit comments

Comments
 (0)