memcpy

c · standard library
sink✓ Reviewed · 2026-09-04
RoleSink
WeaknessCWE-120 · CWE-787
WatchesArgument[0]
Kindbuffer-write
Confidencemedium
Corroboration2

Copies a caller-supplied byte count into a destination without inherent bounds checking.

Argument map · what each slot does

The pack does not provide a callable signature for this record; the watched access path is shown directly.

ArgAccess pathPurposeWatched
Argument[0]Argument[0]The access path Atropos marks for this model.▲ sink
The weakness
CWE-120
Classic Buffer Overflow

Input is copied into an output buffer without checking that it fits.

CWE-787
Out-of-bounds Write

Data is written past the end or before the beginning of its intended buffer.

What goes wrong
Attacker's-eye view · buffer-write

Input longer than the destination overwrites adjacent memory or truncates unexpectedly.

// modeled boundary: Argument[0] memcpy(attacker_influenced_value);
To decide if this call is a bug, check
1Identify destination capacity.
2Check the write length before the call.
3Confirm truncation or rejection is explicit.
These checks require the surrounding codebase. The model names the boundary; it does not decide reachability or prove that a guard dominates every path.
Is this a bug in your code?Atropos stops here — by design

Atropos identifies Argument[0] as a buffer-write sink. It cannot see whether untrusted data reaches this call in your repository.

Lachesis is the codebase-level step: it traces reachability and guards for this symbol.

Check this symbol in Lachesis
Reviewed guidance

Safer direction: Carry destination capacity alongside the buffer and use a bounded operation with a checked length.

Unsafe shape
memcpy(dst, src, user_length);
Safer shape
if (user_length <= dst_capacity) memcpy(dst, src, user_length);
The family · buffer-write

Across languages

No cross-language match.

What neutralizes it

No sanitizer of this kind is modeled.

Model facts · verbatim from the pack
RoleKindAccess pathModel IDConfidence
sinkbuffer-writeArgument[0]c.std.memcpy.a0medium · corrob. 2
summarycopyArgument[1] -> Argument[0]c.std.memcpy.a1-a0high · corrob. 3
sinkbuffer-sizeArgument[2]c.std.memcpy.a2high · corrob. 3
Referencesman7.orgcwe.mitre.org