sqc 0.4.13

Software Code Quality - CERT C compliance checker
[metadata]
id = "STR10-C"
type = "recommendation"
category = "STR"
number = 10
title = "Do not concatenate different type of string literals"
description = """
According toMISRA 2008, concatenation of wide and narrow string literals leads
toundefined behavior. This was once considered implicitly undefined behavior
until C90 [ISO/IEC 9899:1990]. However, C99 defined this behavior [ISO/IEC
9899:1999], and C11 further explains in subclause 6.4.5, paragraph 5 [ISO/IEC
9899:2011]: Nonetheless, it is recommended that string literals that are
concatenated should all be the same type so as not to rely onimplementation-
defined behaviororundefined behaviorif compiled on a platform that supports only
C90. This noncompliant code example concatenates wide and narrow string
literals. Although the behavior is undefined in C90, the programmer probably
intended to create a wide string literal.
"""
severity = "Low"
likelihood = "Probable"
priority = "P4"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 20, 2025"

[rules.cert_c.STR10-C]
enabled = true

[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/STR10-C.+Do+not+concatenate+different+type+of+string+literals"