Is it safe when the request_token.size() is larger than LEN?
char dst[LEN];
memcpy(dst, request_token.c_str(), request_token.size());
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, it’s not safe; you’ll cause a buffer overflow. The reason is,
memcpyhas no way to know the size of your target buffer, other than the size you pass in the third argument.