Fix infinite loop in BIO.readlines

Fixes: https://bugzilla.osafoundation.org/show_bug.cgi?id=12979