Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.7 KiB

  1. /*****************************************************************************\
  2. FILE: BadStrFunctions.cpp
  3. DESCRIPTION:
  4. These header file will map string functions that tend to cause Buffer
  5. OverFlow bugs to warning messages that offer better functions.
  6. BryanSt 1/13/2002 (Bryan Starbuck)
  7. Copyright (C) Microsoft Corp 2002-2002. All rights reserved.
  8. \*****************************************************************************/
  9. #ifndef BADSTRFUNCTIONS_H
  10. #define BADSTRFUNCTIONS_H
  11. #undef wsprintf
  12. #undef wsprintfA
  13. #undef wsprintfW
  14. #define wsprintf USE_wnsprintf_INSTEADOF_wsprintf_SECURITY_BUG
  15. #define wsprintfA USE_wnsprintfA_INSTEADOF_wsprintfA_SECURITY_BUG
  16. #define wsprintfW USE_wnsprintfW_INSTEADOF_wsprintfW_SECURITY_BUG
  17. #undef sprintf
  18. #undef sprintfA
  19. #undef sprintfW
  20. #define sprintf USE_UNDERSCOREsprintf_INSTEADOF_sprintf_SECURITY_BUG
  21. #define sprintfA USE_UNDERSCOREsprintfA_INSTEADOF_sprintfA_SECURITY_BUG
  22. #define sprintfW USE_UNDERSCOREsprintfW_INSTEADOF_sprintfW_SECURITY_BUG
  23. #undef wvsprintf
  24. #undef wvsprintfA
  25. #undef wvsprintfW
  26. #define wvsprintf USE_wvnsprintf_INSTEADOF_wvsprintf_SECURITY_BUG
  27. #define wvsprintfA USE_wvnsprintfA_INSTEADOF_wvsprintfA_SECURITY_BUG
  28. #define wvsprintfW USE_wvnsprintfW_INSTEADOF_wvsprintfW_SECURITY_BUG
  29. #undef vsprintf
  30. #undef _vstprintf
  31. #undef vswprintf
  32. #define vsprintf USE_wvnsprintf_INSTEADOF_vsnprintf_SECURITY_BUG
  33. #define _vstprintf USE_wvnsprintf_INSTEADOF_vsntprintf_SECURITY_BUG
  34. #define vswprintf USE_wvnsprintf_INSTEADOF_vsnwprintf_SECURITY_BUG
  35. // Over time, we want to enable these:
  36. #undef strcpy
  37. #undef strcpyA
  38. #undef strcpyW
  39. #undef lstrcpy
  40. #undef lstrcpyA
  41. #undef lstrcpyW
  42. #undef wcscpy
  43. #undef _tcscpy
  44. #undef _ftcscpy
  45. #undef _mbscpy
  46. #undef _mbccpy
  47. #undef _mbsnbcpy
  48. #undef _mbsncpy
  49. #undef _tccpy
  50. #define strcpy USE_StrCpyN_INSTEADOF_strcpy_SECURITY_BUG
  51. #define strcpyA USE_StrCpyNA_INSTEADOF_strcpyA_SECURITY_BUG
  52. #define strcpyW USE_StrCpyNW_INSTEADOF_strcpyW_SECURITY_BUG
  53. #define lstrcpy USE_StrCpyN_INSTEADOF_lstrcpy_SECURITY_BUG
  54. #define lstrcpyA USE_StrCpyNA_INSTEADOF_lstrcpyA_SECURITY_BUG
  55. #define lstrcpyW USE_StrCpyNW_INSTEADOF_lstrcpyW_SECURITY_BUG
  56. #define wcscpy USE_StrCpyNW_INSTEADOF_wcscpy_SECURITY_BUG
  57. #define _tcscpy USE_StrCpyNW_INSTEADOF_tcscpy_SECURITY_BUG
  58. #define _ftcscpy USE_StrCpyNW_INSTEADOF_ftcscpy_SECURITY_BUG
  59. #define _mbscpy USE_StrCpyNW_INSTEADOF__mbscpy_SECURITY_BUG
  60. #define _mbccpy USE_StrCpyNW_INSTEADOF__mbccpy_SECURITY_BUG
  61. #define _mbsnbcpy USE_StrCpyNW_INSTEADOF__mbsnbcpy_SECURITY_BUG
  62. #define _mbsncpy USE_StrCpyNW_INSTEADOF__mbsncpy_SECURITY_BUG
  63. #define _tccpy USE_StrCpyNW_INSTEADOF__tccpy_SECURITY_BUG
  64. /*
  65. #undef strcat
  66. #undef strcatA
  67. #undef strcatW
  68. #undef lstrcat
  69. #undef lstrcatA
  70. #undef lstrcatW
  71. */
  72. #undef wcscat
  73. #undef _tcscat
  74. #undef _ftcscat
  75. #undef _mbscat
  76. #undef _mbsnbcat
  77. #undef _mbsncat
  78. /*
  79. #define strcat USE_StrCatBuff_INSTEADOF_strcat_SECURITY_BUG
  80. #define strcatA USE_StrCatBuffA_INSTEADOF_strcatA_SECURITY_BUG
  81. #define strcatW USE_StrCatBuffW_INSTEADOF_strcatW_SECURITY_BUG
  82. #define lstrcat USE_StrCatBuff_INSTEADOF_lstrcat_SECURITY_BUG
  83. #define lstrcatA USE_StrCatBuffA_INSTEADOF_lstrcatA_SECURITY_BUG
  84. #define lstrcatW USE_StrCatBuffW_INSTEADOF_lstrcatW_SECURITY_BUG
  85. */
  86. #define wcscat USE_StrCatBuffW_INSTEADOF_wcscat_SECURITY_BUG
  87. #define _tcscat USE_StrCatBuff_INSTEADOF__tcscat_SECURITY_BUG
  88. #define _ftcscat USE_StrCatBuff_INSTEADOF__ftcscat_SECURITY_BUG
  89. #define _mbscat USE_StrCatBuff_INSTEADOF__mbscat_SECURITY_BUG
  90. #define _mbsnbcat USE_StrCatBuff_INSTEADOF__mbsnbcat_SECURITY_BUG
  91. #define _mbsncat USE_StrCatBuff_INSTEADOF__mbsncat_SECURITY_BUG
  92. #undef _makepath
  93. #undef _tmakepath
  94. #undef _wmakepath
  95. #undef _fullpath
  96. #undef _tfullpath
  97. #undef _wfullpath
  98. #undef _wsplitpath
  99. #undef _tsplitpath
  100. #define _makepath USE_PathAppend_INSTEADOF_makepath_SECURITY_BUG
  101. #define _tmakepath USE_PathAppend_INSTEADOF_tmakepath_SECURITY_BUG
  102. #define _wmakepath USE_PathAppend_INSTEADOF_wmakepath_SECURITY_BUG
  103. #define _fullpath USE_PathAppend_INSTEADOF_fullpath_SECURITY_BUG
  104. #define _tfullpath USE_PathAppend_INSTEADOF_tfullpath_SECURITY_BUG
  105. #define _wfullpath USE_PathAppend_INSTEADOF_wfullpath_SECURITY_BUG
  106. #define _wsplitpath USE_PathAppend_INSTEADOF_wsplitpath_SECURITY_BUG
  107. #define _tsplitpath USE_PathAppend_INSTEADOF__tsplitpath_SECURITY_BUG
  108. #endif // BADSTRFUNCTIONS_H