|
Personally feel that there is no way to judge this situation, and the person calling the function must ensure that the passed pointer is valid.
Similar situations also include functions such as strcpy and strcat,
For such a function, the second parameter requires a string ending with '\x00', but if you must pass an unterminated character array into it, the function itself cannot refuse it, and a calculation error is likely to occur.
The responsibility should be borne by the person who calls these functions. |
|