diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-24 06:29:10 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:01:02 -0700 |
commit | d35fec6c72b590957f6515638a64a6e4d0adddf8 (patch) | |
tree | 1757ffddbacf905ef632a7a15c66b3db9b93478a | |
parent | 4643eb699312fbf71d4184f6fac9af209f2bfb50 (diff) | |
download | perl-d35fec6c72b590957f6515638a64a6e4d0adddf8.tar.gz |
Fix thinko in hek_eq_pvn_flags
Doing memEQ(str1, str2, len2) without checking the length
first will cause memEQ("forth","fort"...) to compare equal and
memEQ("fort","forth"...) to read unallocated memory.
This was only a potential future problem, as none of the callers reach
this branch.
-rw-r--r-- | hv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2102,7 +2102,7 @@ hek_eq_pvn_flags(pTHX_ const HEK *hek, const char* pv, const I32 pvlen, const U3 (const U8*)HEK_KEY(hek), HEK_LEN(hek)) == 0); } else - return ((HEK_KEY(hek) == pv) + return HEK_LEN(hek) == pvlen && ((HEK_KEY(hek) == pv) || memEQ(HEK_KEY(hek), pv, pvlen)); } |