Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
newobj
· 3y ago · 0 comments
if dst and src in memcpy overlap, the result is UB. so there's your window of opportunity.
well, you asked...
Comments
[–]
mort96
3y ago
Haha, you're right, it's technically allowed for memcpy to call malloc in that circumstance.
[–]
Tor3
3y ago
memcpy wouldn't, but memmove would. memcpy doesn't check for or care about overlaps (and therefore the result is unpredictable - it'll depend on the implementation)