We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55d2a1b commit cd40da2Copy full SHA for cd40da2
ext/standard/html.c
@@ -939,13 +939,14 @@ static void traverse_for_entities(
939
current_ptr = entity_end_ptr + 1;
940
} else {
941
/* If the entity is invalid, copy characters from current_ptr up to entity_end_ptr */
942
- if (entity_end_ptr) {
943
- for (; current_ptr < entity_end_ptr; current_ptr++) {
944
- *output_ptr++ = *current_ptr;
945
- }
946
- } else {
947
- *output_ptr++ = *current_ptr++;
948
+ if (entity_end_ptr) {
+ size_t len = entity_end_ptr - current_ptr;
+ memcpy(output_ptr, current_ptr, len);
+ output_ptr += len;
+ current_ptr = entity_end_ptr;
+ } else {
+ *output_ptr++ = *current_ptr++;
949
+ }
950
}
951
952
0 commit comments