• Fred Drake's avatar
    Patch from Hrvoje Niksic <hniksic@iskon.hr>: · 56a87a09
    Fred Drake authored
    The bug is in mmap_read_line_method(), and its loop that searches for
    newlines.  After the loop reaches EOF, eol is incremented and points
    after the end of the memory.  This results in readline() method
    sometimes picking up and returning a byte after the end of the string.
    This is usually a bogus \0, but it could cause SIGSEGV if it's after
    the end of the page).
    
    The patch fixes the problem.  Also, it uses memchr() for finding a
    character, which is in fact the "strnchr" the comment is asking for.
    memchr() is already used in Python sources, so there should be no
    portability problems.
    56a87a09