Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Jan 31, 2023
1 parent cc72f9b commit 8c650ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions locale.c
Expand Up @@ -3288,12 +3288,13 @@ S_setlocale_from_aggregate_LC_ALL(pTHX_ const char * locale, const line_t line)
# else /* Positional notation. */

/* Make a writable copy */
const Size_t locale_name_len = strlen(locale);
char * copy;
NewCopy(locale, copy, strlen(locale) + 1, /* Include the trailing NUL */
NewCopy(locale, copy, locale_name_len + 1, /* Include the trailing NUL */
char);

char * s = copy;
char * e = locale + strlen(locale);
char * e = copy + locale_name_len;

for (unsigned int i = 0; i < LC_ALL_CATEGORIES_COUNT_; i++) {

Expand All @@ -3305,7 +3306,7 @@ S_setlocale_from_aggregate_LC_ALL(pTHX_ const char * locale, const line_t line)

/* Find the ending of this locale */
char * next_sep = (i < LC_ALL_CATEGORIES_COUNT_ - 1)
? (char *) instr(s, LC_ALL_SEPARATOR)
? instr(s, LC_ALL_SEPARATOR)
: e;
if (! next_sep) { /* This would be malformed input, with too few
components */
Expand Down

0 comments on commit 8c650ec

Please sign in to comment.