I am new to C++ programming. I am carrying out an SAST violations check for my code, and the scan throws a warning:
_tcscpy(destination_array,Source);
The dangerous function, _tcscpy, was found in use at line 58 in Source.cpp file. Such functions may expose information and allow an attacker to get full control over the host machine
So instead, now I had to use this which makes the warning go away:
_tcscpy_s(destination_array,_countof(destination_array),Source);
What is the actual difference between _tcscpy
and _tcscpy_s
, and how does it make the code safe?