Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this non-compliant example, the first declaration of the identifier x would be classified as externally linked. The second declaration is internally linked. Future use of this identifier can cause undefined behavior.int x; // externally linked

Code Blockpanel
borderColor#black
bgColor#FFCCCCFFCCCC
titleBGColor#F7D6C1
borderStyledashed

int x; // externally linked
int main() {


    static int x; // internally linked


    ...

 // future use of identifier x can cause undefined behavior
.

}

Compliant Solution

In this compliant solution, more descriptive identifier names are used, so as to avoid this problem.int externalInt; // externally linked

Code Blockpanel
borderColor#black
bgColorccccff
titleBGColor#F7D6C1
borderStyledashed

int external_x; // externally linked
int main() {


    static int
internalInt
 internal_x; // internally linked


    ...


}

Risk Assessment

Use of an identifier classified as both internally and externally linked causes undefined behavior in the program. However, it would be highly unlikely that an attacker could exploit this behavior to run arbitrary code.

...