Skip to content

Commit

Permalink
[regex] Prevent null character breaking patterns
Browse files Browse the repository at this point in the history
e.g. `new EReg("abc\x00def", "")` would erroneously match "abc"

HaxeFoundation/haxe#10592
  • Loading branch information
tobil4sk committed Feb 15, 2022
1 parent c0e879f commit 533f537
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/regexp/regexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static value regexp_new_options( value s, value opt ) {
break;
}
}
p = pcre2_compile(val_string(s),PCRE2_ZERO_TERMINATED,options,&error_num,&err_offset,NULL);
p = pcre2_compile(val_string(s),val_strlen(s),options,&error_num,&err_offset,NULL);
if( p == NULL ) {
buffer b = alloc_buffer("Regexp compilation error : ");
PCRE2_UCHAR error_buffer[256];
Expand Down

0 comments on commit 533f537

Please sign in to comment.