01.07.2016 Views

SEI CERT C Coding Standard

tqcylJ

tqcylJ

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Preprocessor (PRE) - PRE30-C. Do not create a universal character name through concatenation<br />

2.1.2 Compliant Solution<br />

This compliant solution uses a universal character name but does not create it by using token concatenation:<br />

#define assign(ucn, val) ucn = val<br />

void func(void) {<br />

int \u0401;<br />

/* ... */<br />

assign(\u0401, 4);<br />

/* ... */<br />

}<br />

2.1.3 Risk Assessment<br />

Creating a universal character name through token concatenation results in undefined behavior.<br />

Rule Severity Likelihood Remediation Cost Priority Level<br />

PRE30-C Low Unlikely Medium P2 L3<br />

2.1.4 Bibliography<br />

[ISO/IEC 10646-2003]<br />

[ISO/IEC 9899:2011]<br />

Subclause 5.1.1.2, “Translation Phases”<br />

<strong>SEI</strong> <strong>CERT</strong> C <strong>Coding</strong> <strong>Standard</strong>: Rules for Developing Safe, Reliable, and Secure Systems 24<br />

Software Engineering Institute | Carnegie Mellon University<br />

[DISTRIBUTION STATEMENT A] Approved for public release and unlimited distribution.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!