This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author wmeehan
Recipients wmeehan
Date 2020-08-11.22:01:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597183298.26.0.225375554526.issue41524@roundup.psfhosted.org>
In-reply-to
Content
The existing implementation of PyOS_mystricmp increments both pointers as long as the first string hasn't reached the end yet. If the second string ends first, then we increment past the null byte. If there is a difference in the middle of the two strings, then the result actually compares the following pair of letters.

e.g.
PyOS_mystricmp("a", "\0") => 0 (should be positive)
PyOS_mystricmp("foo", "fro") => 0 (should be negative)

Similarly, PyOS_mystrnicmp increments the pointers in a condition before breaking out of the loop. It's possible to increment the first pointer without incrementing the second, and the result is the character past the null byte.

e.g.
PyOS_mystrnicmp("\0a", "\0b", 2) => 97 (should be negative)
History
Date User Action Args
2020-08-11 22:01:38wmeehansetrecipients: + wmeehan
2020-08-11 22:01:38wmeehansetmessageid: <1597183298.26.0.225375554526.issue41524@roundup.psfhosted.org>
2020-08-11 22:01:38wmeehanlinkissue41524 messages
2020-08-11 22:01:36wmeehancreate