Add a function for truncating at NUL.