I have a c++ application, in which customer reported a crash.But the crash is not easily reproducible. After analysing some logs and all i found that the crash may occure in between the following code portions. Please tell me there is any chance of getting crashed the application if i have these code statements in it?
//Tesrt
std::string strAppName = "App1\0";
int nSize = 10;
sprintf_s(szBuff, "The appname %s have %d dependancies ", strAppName.c_str(), nSize);
//Then use the szBuff to log to a text file
//Test end
strAppNameis redundant.sprintf_swithsprintf. Also, assuming anintto be 32-bit is not very portable.int, I'm not sure if there is any implementation with 64-bit, though (according to Wikipedia).sprintf_seither takes achararray by reference OR a pointer tocharand a size parameter.