zoukankan      html  css  js  c++  java
  • [转]Unsafe at any speed: Memcpy() banished in Redmond

    原文地址:http://www.theregister.co.uk/2009/05/15/microsoft_banishes_memcpy/

    Memcpy() and brethren, your days are numbered. At least in development shops that aspire to secure coding.

    Microsoft plans to formally banish the popular programming function that's been responsible for an untold number of security vulnerabilities over the years, not just in Windows but in countless other applications based on the C language. Effective later this year, Microsoft will add memcpy(), CopyMemory(), and RtlCopyMemory() to its list of function calls banned under its secure development lifecycle.

    Memcpy has long served as a basic staple of C-based languages, providing a simple way to copy the contents from one chunk of memory to another. Its drawback comes when the source to be copied contains more bytes than its destination, creating overflows that present attackers with opportunities to remotely execute code in the underlying application.

    "That's definitely one of those notoriously dangerous C commands," said Johannes Ullrich, CTO of the SANS Institute, who teaches secure coding classes to developers. He likened memcpy() to other risky functions such as strcpy() and strcat(), which Microsoft has already banned after exacting untold misery over the years.

    Developers who want to be SDL compliant will instead have to replace memcpy() functions with memcpy_s, a newer command that takes an additional parameter delineating the size of the destination buffer. The command is already supported in Microsoft's Visual C++, but according to Ullrich, native support doesn't yet seem to be available in the GCC compiler. (This evidently can easily be worked around, according to this discussion. Readers who know other approaches are encouraged to leave a comment.)

    A Microsoft blog entry that heralded the planned change suggests modifying common header files so compilers issue a warning each time the banned function is used.

    It also wondered aloud when "Larry, Steve, and Linus" plan to issue similar security edicts in their products. It's a question worth asking. ®

  • 相关阅读:
    安装oracle11g服务端
    安装oracle11g客户端
    Python生成requirements.txt方法
    oracle创建新用户并授予权限
    正向代理与反向代理【总结】
    使用Eclipse调试Java程序的10个技巧
    如果长颈鹿哭了,它会不会要哽咽好久
    你应该知道的10种软件工具
    我希望在20岁时就知道的26条时间管理技巧
    Vue使用NProgress (NProgress是页面跳转是出现在浏览器顶部的进度条)
  • 原文地址:https://www.cnblogs.com/cxun/p/1459172.html
Copyright © 2011-2022 走看看