• <bdo id='bAOl1'></bdo><ul id='bAOl1'></ul>
    1. <small id='bAOl1'></small><noframes id='bAOl1'>

    2. <i id='bAOl1'><tr id='bAOl1'><dt id='bAOl1'><q id='bAOl1'><span id='bAOl1'><b id='bAOl1'><form id='bAOl1'><ins id='bAOl1'></ins><ul id='bAOl1'></ul><sub id='bAOl1'></sub></form><legend id='bAOl1'></legend><bdo id='bAOl1'><pre id='bAOl1'><center id='bAOl1'></center></pre></bdo></b><th id='bAOl1'></th></span></q></dt></tr></i><div id='bAOl1'><tfoot id='bAOl1'></tfoot><dl id='bAOl1'><fieldset id='bAOl1'></fieldset></dl></div>

      1. <legend id='bAOl1'><style id='bAOl1'><dir id='bAOl1'><q id='bAOl1'></q></dir></style></legend><tfoot id='bAOl1'></tfoot>

        C++ 'strcpy' 发出警告 (C4996)

        时间:2023-10-05
          <tbody id='HB8Zl'></tbody>

        <i id='HB8Zl'><tr id='HB8Zl'><dt id='HB8Zl'><q id='HB8Zl'><span id='HB8Zl'><b id='HB8Zl'><form id='HB8Zl'><ins id='HB8Zl'></ins><ul id='HB8Zl'></ul><sub id='HB8Zl'></sub></form><legend id='HB8Zl'></legend><bdo id='HB8Zl'><pre id='HB8Zl'><center id='HB8Zl'></center></pre></bdo></b><th id='HB8Zl'></th></span></q></dt></tr></i><div id='HB8Zl'><tfoot id='HB8Zl'></tfoot><dl id='HB8Zl'><fieldset id='HB8Zl'></fieldset></dl></div>
          <legend id='HB8Zl'><style id='HB8Zl'><dir id='HB8Zl'><q id='HB8Zl'></q></dir></style></legend>

          <small id='HB8Zl'></small><noframes id='HB8Zl'>

            <bdo id='HB8Zl'></bdo><ul id='HB8Zl'></ul>
                • <tfoot id='HB8Zl'></tfoot>
                  本文介绍了C++ 'strcpy' 发出警告 (C4996)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我收到此警告,但所有功能都正常工作.

                  I am getting this warning but all functions working properly .

                  这到底意味着什么?

                  'strcpy': This function or variable may be unsafe. 
                  Consider using strcpy_s instead. To disable deprecation, 
                  use _CRT_SECURE_NO_WARNINGS. See online help for details.
                  

                  推荐答案

                  这个函数 (strcpy) 被认为是不安全的,因为没有边界检查并且可能导致缓冲区溢出.(实际上 strcpy 因溢出漏洞而臭名昭著,所有程序员都避免使用它——或者至少应该避免使用它).建议是使用考虑目标缓冲区大小的安全函数以避免溢出.您也可以使用 strncpy (但要小心!).您的代码没有问题,即函数将按您说的方式运行,但尝试提供一个大于目标缓冲区的缓冲区作为输入.该函数将溢出目标缓冲区.检查这个也链接文本

                  This function (strcpy) is considered unsafe due to the fact that there is no bounds checking and can lead to buffer overflow. (Actually strcpy is infamous for overflow exploits and all programmers avoid it-or at least should avoid it). The advice is to use a safe function which takes into account the size of the destination buffer to avoid overflow. You could also use strncpy (BUT with caution!). There is no problem with your code, i.e. the functions will run as you say but try giving as input a buffer that is larger than the destination buffer. The function will overflow the destination buffer. Check this also link text

                  这篇关于C++ 'strcpy' 发出警告 (C4996)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++:Setenv().Visual Studio 中的未定义标识符 下一篇:即使找到接口,CoCreateInstance 也返回 E_NOINTERFACE

                  相关文章

                  最新文章

                • <i id='XkKrI'><tr id='XkKrI'><dt id='XkKrI'><q id='XkKrI'><span id='XkKrI'><b id='XkKrI'><form id='XkKrI'><ins id='XkKrI'></ins><ul id='XkKrI'></ul><sub id='XkKrI'></sub></form><legend id='XkKrI'></legend><bdo id='XkKrI'><pre id='XkKrI'><center id='XkKrI'></center></pre></bdo></b><th id='XkKrI'></th></span></q></dt></tr></i><div id='XkKrI'><tfoot id='XkKrI'></tfoot><dl id='XkKrI'><fieldset id='XkKrI'></fieldset></dl></div>
                • <small id='XkKrI'></small><noframes id='XkKrI'>

                      <tfoot id='XkKrI'></tfoot>
                    1. <legend id='XkKrI'><style id='XkKrI'><dir id='XkKrI'><q id='XkKrI'></q></dir></style></legend>
                        <bdo id='XkKrI'></bdo><ul id='XkKrI'></ul>