task06 - fix buf length check while reading