3 ms·
The more I think about this, the more sense it makes to say you should check the length of the buffer before they copy. I'm not sure an assert is always right,
by gweinberg 8y ago
The more I think about this, the more sense it makes to say you should check the length of the buffer before they copy. I'm not sure an assert is always right, exactly what should be done if the string doesn't fit may depend on what the program is doing. But silently truncating is generally not the right thing to do.