Code Monkey home page Code Monkey logo

banned's Introduction

banned

Banned.h - deprecated C runtime functions

I wrote this header many, MANY moons ago while working on the early versions of the Security Development Lifecycle (www.microsoft.com/sdl) at Microsoft.

I have always been a big fan of making tasks as simple as possible and I figured creating a header that deprecated (VC++) or poisoned (gcc) known insecure C runtime functions is very low tech and works well! We made using banned.h a requirement for all unmanaged C and C++ code across the company.

Over the years we split the list of banned functions into two groups: those that are banned and those you should consider not using in your code.

If you add the following before referencing banned.h:

#define _SDL_BANNED_RECOMMENDED

Then the more agressive list of banned functions are also deprecated/poisoned.

If you use strsafe.h in the code prior to referencing banned.h; the header will deprecate a smaller list of functions because the 'rogues gallery' is already deprecated by strsafe.h. More info at https://msdn.microsoft.com/en-us/library/windows/desktop/ms647466(v=vs.85).aspx

Finally, by default, banned.h will add these two:

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES (1)

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY (1)

Which auto-migrates certain functions to safer functions if the destination buffer size is known at compile time. More info at https://docs.microsoft.com/en-us/cpp/c-runtime-library/secure-template-overloads

The header is still actively used across Microsoft and various other companies, but it's not the only way of managing the 'insecure API' problem.

For example, VC++ has the C4996 depracation warning, but this addresses more than security. https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996 for more info.

banned's People

Contributors

mikehow avatar x509cert avatar yesmar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.