sqc 0.4.13

Software Code Quality - CERT C compliance checker
[metadata]
id = "POS39-C"
type = "rule"
category = "POS"
number = 39
title = "Use the correct byte ordering when transferring data between systems"
description = """
Different system architectures use different byte ordering, either little endian
(least significant byte first) or big endian (most significant byte first).
IA-32 is an example of an architecture that implements little endian byte
ordering. In contrast, PowerPC and most Network Protocols (including TCP and IP)
use big endian. When transferring data between systems of different endianness,
the programmer must take care to reverse the byte ordering before interpreting
the data. The functionshtonl(),htons(),ntohl(), andntohs()can be used to
transfer between network byte ordering (big endian) and the host's byte
ordering. On big endian systems, these functions do nothing. They may also be
implemented as macros rather than functions.
"""
severity = "Medium"
likelihood = "Likely"
priority = "P12"
level = "L1"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 06, 2025"

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

[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/POS39-C.+Use+the+correct+byte+ordering+when+transferring+data+between+systems"