Fix for mid lbuf reuse issue

Something odd with mid, I'm not sure what the root cause is. This patch does not address the root cause, but it does fix the issue with mid.

The symptom is this: Occasionally, mid() called with a starting position beyond the length of the string will return recognizable text from older LBUFs. I've added a check to mid() to handle this case. Steps to reproduce on a completely clean environment:

1. @dol [lnum(10)]=th [iter(lnum(1000),lnum(1000),,%r)]
2. th [mid(abc,50,50)]