Be careful, here you are erasing the last character of the string! You want to append the NULL character (so the best is probably to do so using a mutable `MCStringRef`; although I'm not sure `MCStringRef` can be non-NULL terminated. Mark?)
You should also check whether `p_value` is an actual `MCStringRef` before assuming it is one.