Fix segfault when shrinking shell window

Hi robem,

I fixed a problem where you overrun your stack allocated buffer which causes a segfault. I was able to trigger it by shrinking the shell window to a really small size.