Udostępnij za pośrednictwem


Tainted

The Tainted property specifies whether a value is safe for use by other functions. This property is allowed on Pre and Post attributes and can be applied to any data type.

The Tainted property must be set by using one of the following values:

  • SA_Yes - the value is tainted and cannot be trusted.

  • SA_No - the value is not tainted and can be trusted.

  • SA_Maybe - the value might be tainted and cannot be trusted.

The C6029 code analysis warning is fired if the value of a parameter that is marked [Post(Tainted=Yes)] is immediately passed to a parameter that is marked [Pre(Tainted=No)].

Example

The following code shows how to use the Tainted property:

// C 
#include <CodeAnalysis\SourceAnnotations.h>
void f([SA_Pre(Tainted=SA_Yes)] int c);

// C++
#include <CodeAnalysis\SourceAnnotations.h>
using namespace vc_attributes;
void f([Pre(Tainted=Yes)] int c);m

See Also

Concepts

Annotation Overview

Other Resources

Annotation Properties