Is it safe when the request_token.size()
is larger than LEN
?
char dst[LEN];
memcpy(dst, request_token.c_str(), request_token.size());
No, it's not safe; you'll cause a buffer overflow. The reason is, memcpy
has no way to know the size of your target buffer, other than the size you pass in the third argument.
No, definitely not, that will lead to buffer overrun and trigger undefined behavior which will lead to all sorts of bad things, included but not limited to data corruption and program crashing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With