Properly resize the buffer based on ERROR_MORE_DATA.