Skip to content

Commit

Permalink
do_join: validate arguments before we start using them
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed Sep 21, 2023
1 parent 265f70e commit a7ce2f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doop.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,8 @@ Magic and tainting are handled.
void
Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp)
{
PERL_ARGS_ASSERT_DO_JOIN;

SV ** const oldmark = mark;
SSize_t items = sp - mark;
STRLEN len;
Expand All @@ -673,8 +675,6 @@ Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp)
char delim_buf[JOIN_DELIM_BUFSIZE];
bool delim_do_utf8 = DO_UTF8(delim);

PERL_ARGS_ASSERT_DO_JOIN;

if (items >= 2) {
/* Make a copy of the delim, since G or A magic may modify the delim SV.
Use a local buffer if possible to avoid the cost of allocation and
Expand Down

0 comments on commit a7ce2f0

Please sign in to comment.