@@ -149,7 +149,8 @@ lex_mode_push_list(pm_parser_t *parser, bool interpolation, uint8_t delimiter) {
149149 // These are the places where we need to split up the content of the list.
150150 // We'll use strpbrk to find the first of these characters.
151151 uint8_t *breakpoints = lex_mode.as.list.breakpoints;
152- memcpy(breakpoints, "\\ \t\f\r\v\n\0\0\0", sizeof(lex_mode.as.list.breakpoints));
152+ memset(breakpoints, 0, PM_STRPBRK_CACHE_SIZE);
153+ memcpy(breakpoints, "\\ \t\f\r\v\n", sizeof("\\ \t\f\r\v\n") - 1);
153154 size_t index = 7;
154155
155156 // Now we'll add the terminator to the list of breakpoints. If the
@@ -201,7 +202,8 @@ lex_mode_push_regexp(pm_parser_t *parser, uint8_t incrementor, uint8_t terminato
201202 // regular expression. We'll use strpbrk to find the first of these
202203 // characters.
203204 uint8_t *breakpoints = lex_mode.as.regexp.breakpoints;
204- memcpy(breakpoints, "\r\n\\#\0\0", sizeof(lex_mode.as.regexp.breakpoints));
205+ memset(breakpoints, 0, PM_STRPBRK_CACHE_SIZE);
206+ memcpy(breakpoints, "\r\n\\#", sizeof("\r\n\\#") - 1);
205207 size_t index = 4;
206208
207209 // First we'll add the terminator.
@@ -237,7 +239,8 @@ lex_mode_push_string(pm_parser_t *parser, bool interpolation, bool label_allowed
237239 // These are the places where we need to split up the content of the
238240 // string. We'll use strpbrk to find the first of these characters.
239241 uint8_t *breakpoints = lex_mode.as.string.breakpoints;
240- memcpy(breakpoints, "\r\n\\\0\0\0", sizeof(lex_mode.as.string.breakpoints));
242+ memset(breakpoints, 0, PM_STRPBRK_CACHE_SIZE);
243+ memcpy(breakpoints, "\r\n\\", sizeof("\r\n\\") - 1);
241244 size_t index = 3;
242245
243246 // Now add in the terminator. If the terminator is not already a NULL byte,
@@ -12054,7 +12057,7 @@ parser_lex(pm_parser_t *parser) {
1205412057 // Otherwise we'll be parsing string content. These are the places
1205512058 // where we need to split up the content of the heredoc. We'll use
1205612059 // strpbrk to find the first of these characters.
12057- uint8_t breakpoints[] = "\r\n\\#";
12060+ uint8_t breakpoints[PM_STRPBRK_CACHE_SIZE ] = "\r\n\\#";
1205812061
1205912062 pm_heredoc_quote_t quote = heredoc_lex_mode->quote;
1206012063 if (quote == PM_HEREDOC_QUOTE_SINGLE) {
0 commit comments