]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
PyUnicode_Contains(): The memcmp() call didn't take into account the
authorBarry Warsaw <barry@python.org>
Tue, 6 Aug 2002 19:03:17 +0000 (19:03 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 6 Aug 2002 19:03:17 +0000 (19:03 +0000)
width of Py_UNICODE.  Good catch, MAL.

Objects/unicodeobject.c

index a577bfd4d77f8e16e5708e5933285a1c27c16547..03b5dbd9704d2a8b652c28c1cc2f394c27865bc0 100644 (file)
@@ -3765,7 +3765,7 @@ int PyUnicode_Contains(PyObject *container,
     else {
        end = lhs + (PyUnicode_GET_SIZE(u) - size);
        while (lhs <= end) {
-           if (memcmp(lhs++, rhs, size) == 0) {
+           if (memcmp(lhs++, rhs, size * sizeof(Py_UNICODE)) == 0) {
                result = 1;
                break;
            }