Fixed an bug found by running LLDB with the address sanitizer! We were accessing one past the end of the buffer.