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