Skip to content

Insecure string processing functions

Description

The `strecpy` and `streadd` functions require that the destination buffer size be at least four times the size of the source due to each character potentially becoming a `` and 3 digits.

Examples

Insecure Code

c
strecpy(dest, src);

Secure Code

c
snprintf(dest, sizeof(dest), "%s", src);

Remediation

Use safer string processing functions or ensure the destination buffer size is at least four times the size of the source.

Rule Details

FieldValue
IDCODE-0581
CategoryInjection
SeverityHIGH
CWECWE-120
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsinsecure-function, buffer-overflow
OWASPA1:2017-Injection, A03:2021-Injection