Hacker News new | past | comments | ask | show | jobs | submit
It looks like the original author did actually try to account for this by allocating 20 more bytes than the input length.

From the blog post:

    The output buffer is allocated as the input length plus 20 bytes. Each ß adds one byte to the output, so an input with 21 of them overflows the buffer by one byte.