Skip to content

Commit 9a2a76f

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 5af3f88 + 94f094a commit 9a2a76f

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

docs/c-runtime-library/reference/crtsetdebugfillthreshold.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
title: "_CrtSetDebugFillThreshold"
33
description: "Use the _CrtSetDebugFillThreshold function to set the maximum amount of buffer to fill in secure CRT functions."
4-
ms.date: "10/31/2019"
4+
ms.date: 04/10/2025
55
api_name: ["_CrtSetDebugFillThreshold"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll"]
77
api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["_CrtSetDebugFillThreshold", "CrtSetDebugFillThreshold"]
1010
helpviewer_keywords: ["debug, buffer-filling behavior", "CrtSetDebugFillThreshold function", "_CrtSetDebugFillThreshold function", "buffer-filling behavior", "0xFE"]
11-
ms.assetid: 6cb360e8-56ae-4248-b17f-e28aee3e0ed7
1211
---
1312
# `_CrtSetDebugFillThreshold`
1413

@@ -38,58 +37,36 @@ The default threshold is `SIZE_T_MAX`.
3837
Here's a list of the affected functions:
3938
4039
- [`asctime_s`, `_wasctime_s`](asctime-s-wasctime-s.md)
41-
4240
- [`_cgets_s`, `_cgetws_s`](cgets-s-cgetws-s.md)
43-
4441
- [`ctime_s`, `_ctime32_s`, `_ctime64_s`, `_wctime_s`, `_wctime32_s`, `_wctime64_s`](ctime-s-ctime32-s-ctime64-s-wctime-s-wctime32-s-wctime64-s.md)
45-
4642
- [`_ecvt_s`](ecvt-s.md)
47-
4843
- [`_fcvt_s`](fcvt-s.md)
49-
5044
- [`_gcvt_s`](gcvt-s.md)
51-
5245
- [`_itoa_s`, `_ltoa_s`, `_ultoa_s`, `_i64toa_s`, `_ui64toa_s`, `_itow_s`, `_ltow_s`, `_ultow_s`, `_i64tow_s`, `_ui64tow_s`](itoa-s-itow-s.md)
53-
5446
- [`_makepath_s`, `_wmakepath_s`](makepath-s-wmakepath-s.md)
55-
5647
- [`_mbsnbcat_s`, `_mbsnbcat_s_l`](mbsnbcat-s-mbsnbcat-s-l.md)
57-
5848
- [`_mbsnbcpy_s`, `_mbsnbcpy_s_l`](mbsnbcpy-s-mbsnbcpy-s-l.md)
59-
6049
- [`_mbsnbset_s`, `_mbsnbset_s_l`](mbsnbset-s-mbsnbset-s-l.md)
61-
6250
- [`_mktemp_s`, `_wmktemp_s`](makepath-s-wmakepath-s.md)
63-
6451
- [`_splitpath_s`, `_wsplitpath_s`](splitpath-s-wsplitpath-s.md)
65-
6652
- [`strcat_s`, `wcscat_s`, `_mbscat_s`](strcat-s-wcscat-s-mbscat-s.md)
67-
6853
- [`strcpy_s`, `wcscpy_s`, `_mbscpy_s`](strcpy-s-wcscpy-s-mbscpy-s.md)
69-
7054
- [`_strdate_s`, `_wstrdate_s`](strdate-s-wstrdate-s.md)
71-
7255
- [`strerror_s`, `_strerror_s`, `_wcserror_s`, `__wcserror_s`](strerror-s-strerror-s-wcserror-s-wcserror-s.md)
73-
7456
- [`_strlwr_s`, `_strlwr_s_l`, `_mbslwr_s`, `_mbslwr_s_l`, `_wcslwr_s`, `_wcslwr_s_l`](strlwr-s-strlwr-s-l-mbslwr-s-mbslwr-s-l-wcslwr-s-wcslwr-s-l.md)
75-
7657
- [`strncat_s`, `_strncat_s_l`, `wcsncat_s`, `_wcsncat_s_l`, `_mbsncat_s`, `_mbsncat_s_l`](strncat-s-strncat-s-l-wcsncat-s-wcsncat-s-l-mbsncat-s-mbsncat-s-l.md)
77-
7858
- [`strncpy_s`, `_strncpy_s_l`, `wcsncpy_s`, `_wcsncpy_s_l`, `_mbsncpy_s`, `_mbsncpy_s_l`](strncpy-s-strncpy-s-l-wcsncpy-s-wcsncpy-s-l-mbsncpy-s-mbsncpy-s-l.md)
79-
8059
- [`_strnset_s`, `_strnset_s_l`, `_wcsnset_s`, `_wcsnset_s_l`, `_mbsnset_s`, `_mbsnset_s_l`](strnset-s-strnset-s-l-wcsnset-s-wcsnset-s-l-mbsnset-s-mbsnset-s-l.md)
81-
8260
- [`_strset_s`, `_strset_s_l`, `_wcsset_s`, `_wcsset_s_l`, `_mbsset_s`, `_mbsset_s_l`](strset-s-strset-s-l-wcsset-s-wcsset-s-l-mbsset-s-mbsset-s-l.md)
83-
8461
- [`_strtime_s`, `_wstrtime_s`](strtime-s-wstrtime-s.md)
85-
8662
- [`_strupr_s`, `_strupr_s_l`, `_mbsupr_s`, `_mbsupr_s_l`, `_wcsupr_s`, `_wcsupr_s_l`](strupr-s-strupr-s-l-mbsupr-s-mbsupr-s-l-wcsupr-s-wcsupr-s-l.md)
87-
63+
- [`vsnprintf_s`, `_vsnprintf_s`, `_vsnprintf_s_l`, `_vsnwprintf_s`, _vsnwpr`intf_s_l](vsnprintf-s-vsnprintf-s-vsnprintf-s-l-vsnwprintf-s-vsnwprintf-s-l.md)
64+
8865
## Requirements
8966
9067
| Routine | Required header |
9168
|---|---|
92-
| **`_CrtSetDebugFillThreshold`** | \<crtdbg.h> |
69+
| **`_CrtSetDebugFillThreshold`** | `<crtdbg.h>` |
9370
9471
This function is Microsoft-specific. For more compatibility information, see [Compatibility](../compatibility.md).
9572

docs/c-runtime-library/security-features-in-the-crt.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ms.date: "09/29/2020"
55
ms.topic: "conceptual"
66
f1_keywords: ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE", "_CRT_NONSTDC_NO_WARNINGS", "_CRT_SECURE_NO_WARNINGS"]
77
helpviewer_keywords: ["security deprecation warnings [C++]", "CRT_NONSTDC_NO_DEPRECATE", "buffers [C++], buffer overruns", "deprecation warnings (security-related), disabling", "_CRT_NONSTDC_NO_WARNINGS", "security [CRT]", "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE", "_CRT_SECURE_NO_DEPRECATE", "security-enhanced CRT", "CRT_SECURE_NO_WARNINGS", "CRT_SECURE_NO_DEPRECATE", "deprecation warnings (security-related)", "buffer overruns", "CRT_NONSTDC_NO_WARNINGS", "CRT, security enhancements", "parameters [C++], validation"]
8-
ms.assetid: d9568b08-9514-49cd-b3dc-2454ded195a3
98
---
109
# Security Features in the CRT
1110

@@ -19,7 +18,7 @@ For example, the `strcpy` function can't tell if the string it copies is too lar
1918

2019
## Eliminating deprecation warnings
2120

22-
There are several ways to eliminate deprecation warnings for the older, less secure functions. The simplest is simply to define `_CRT_SECURE_NO_WARNINGS` or use the [`warning`](../preprocessor/warning.md) pragma. Either will disable deprecation warnings, but the security issues that caused the warnings still exist. It's better to leave deprecation warnings enabled and take advantage of the new CRT security features.
21+
There are several ways to eliminate deprecation warnings for the older, less secure functions. The simplest is simply to define `_CRT_SECURE_NO_WARNINGS` or use the [`warning`](../preprocessor/warning.md) pragma. Either disables deprecation warnings, but the security issues that caused the warnings still exist. It's better to leave deprecation warnings enabled and take advantage of the new CRT security features.
2322

2423
In C++, the easiest way to eliminate the deprecation warnings is to use [Secure template overloads](./secure-template-overloads.md). The overloads eliminate deprecation warnings in many cases. They replace calls to deprecated functions with calls to secure versions of the functions. For example, consider this deprecated call to `strcpy`:
2524

@@ -54,13 +53,15 @@ Some of the security features include:
5453
5554
You must pass the buffer size to any secure function that writes to a buffer. The secure versions validate that the buffer is large enough before writing to it. The validation helps avoid dangerous buffer overrun errors that could allow malicious code to execute. These functions usually return an `errno` error code and invoke the invalid parameter handler if the size of the buffer is too small. Functions that read from input buffers, such as `gets`, have secure versions that require you to specify a maximum size.
5655
56+
The debug versions of *some* security-enhanced CRT functions fill the buffer passed to them with a special character (0xFE). This fill character helps to find cases where the incorrect size was passed to the function. Unfortunately, it also reduces performance. To improve performance, use **`_CrtSetDebugFillThreshold`** to disable buffer-filling. For more information, and a list of functions that have this behavior, see [`_CrtSetDebugFillThreshold`](./reference/crtsetdebugfillthreshold.md).
57+
5758
- **Null termination**
5859
59-
Some functions that left potentially non-terminated strings have secure versions, which ensure that strings are properly null-terminated.
60+
Some functions that left potentially nonterminated strings have secure versions, which ensure that strings are properly null-terminated.
6061
6162
- **Enhanced error reporting**
6263
63-
The secure functions return error codes with more error information than was available with the pre-existing functions. The secure functions and many of the pre-existing functions now set `errno` and often return an `errno` code type as well, to provide better error reporting.
64+
The secure functions return error codes with more error information than was available with the preexisting functions. The secure functions and many of the preexisting functions now set `errno` and often return an `errno` code type as well, to provide better error reporting.
6465
6566
- **Filesystem security**
6667

0 commit comments

Comments
 (0)