[metadata]
id = "INT31-C"
type = "rule"
category = "INT"
number = 31
title = "Ensure that integer conversions do not result in lost or misinterpreted data"
description = """
Integer conversions, both implicit and explicit (using a cast), must be
guaranteed not to result in lost or misinterpreted data. This rule is
particularly true for integer values that originate from untrusted sources and
are used in any of the following ways: This rule also applies to arguments
passed to the following library functions that are converted tounsigned char:
and to arguments to the following library functions that are converted tochar:
"""
severity = "High"
likelihood = "Probable"
priority = "P12"
level = "L1"
cert_version = "2016 Edition (Wiki)"
last_modified = "Oct 29, 2025"
[rules.cert_c.INT31-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/INT31-C.+Ensure+that+integer+conversions+do+not+result+in+lost+or+misinterpreted+data"
cwe = ["CWE-192", "CWE-197", "CWE-681", "CWE-704", "CWE-195", "CWE-194", "CWE-20"]