Coverity detected two "Memory - illegal accesses (OVERRUN)" issues. Resizing the buffer should silence this warning.