I would guess your find length does not work on an empty string.
I could see this causing in to crash.

I suggest making your own copy of strlen and testing that so it works right; then doing this...