>??????? memset(&str->data[str->length], 0, len - str->length); The intent is to blank out everything from what was currently written. This "covers up" possible pointer over-runs. We could do just from the old max.