diff
186 if ((in_space) && (normalize)) {
187     while (buf[len - 1] == 0x20 && len > 0) len--;
188+    if (len < 0) len = 0;
189 }
