cherry-pick: terminate the commit id string

We treat this as a NUL-terminated string, so make sure that we add the
terminator.