Skip to content

Commit fb8f6fa

Browse files
authored
Merge pull request #3985 from ruby/fix-overflow
Fix reading past end of target names
2 parents ae5ea48 + 1d6a966 commit fb8f6fa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/regexp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ typedef enum {
436436
*/
437437
static inline bool
438438
pm_regexp_property_name_matches(const uint8_t *name, size_t length, const char *target) {
439-
return target[length] == '\0' && pm_strncasecmp(name, (const uint8_t *) target, length) == 0;
439+
return strlen(target) == length && pm_strncasecmp(name, (const uint8_t *) target, length) == 0;
440440
}
441441

442442
/**

0 commit comments

Comments
 (0)