MAP: replace strncpy with strncpy_s#2417
Conversation
The intel c++ w_oneAPI_2021.1.1.99 compiler does not like the `strncpy` function and won't compile. Changing to `strncpy_s`.
|
Of course, changing to |
|
I had an issue with this a few days ago using the Visual Studio 2022 v143 C/C++ compiler. I added the openfast/modules/map/src/mapapi.h Line 39 in 32ad558 but Visual Studio had also turned on the compiling option Additional Security Development Lifecycle (SDL) recommended checks, which made the warning an error. When I removed the \SDL option, it was able to build with the strncpy routine.
This may be helpful: https://stackoverflow.com/questions/22450423/how-to-use-crt-secure-no-warnings |
|
Microsoft is a truck load of shit... Anyway, I would say the smartest solution would be replacing the offending line --and the following one-- by: Checkout the critics of Ulrich Drepper to I wrote that code directly here, on GitHub. It is not even tested. |
this should work with all compilers Co-authored-by: Derek Slaughter <deslaughter@gmail.com>
|
In trying out @deslaughter's suggestion, I discovered there is a |

Ready to merge (need someone with actual C knowledge to review it though).
Feature or improvement description
The intel c++ w_oneAPI_2021.1.1.99 compiler does not like the
strncpyfunction and won't compile. Changing tostrncpy_s.Related issue, if one exists
See comment here: 93e2d27#r14664285 from PR #2394
Impacted areas of the software
Compilation of MAP with some compilers.
@sanguinariojoe, can you check this?