I'm using MSVC to compile some C code which uses standard-library functions, such as getenv()
, sprintf
and others, with /W3
set for warnings. I'm told by MSVC that:
'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS
Questions:
- Why would this be unsafe, theoretically - as opposed to its use on other platforms?
- Is it unsafe on Windows in practice?
- Assuming I'm not writing security-oriented code - should I disable this warning or actually start aliasing a bunch of standard library functions?