Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static UINT32 safe_buffer_copy(const void *source, UINT32 sourceoffs, UINT32 sourcelen, void *dest, UINT32 destoffs, UINT32 destlen)
- {
- int sourceavail = sourcelen - sourceoffs;
- int destavail = destlen - destoffs;
- int bytes_to_copy = sourceavail < destavail ? sourceavail : destavail;
- if (bytes_to_copy > 0)
- memcpy((UINT8 *)dest + destoffs, (const UINT8 *)source + sourceoffs, bytes_to_copy);
- return bytes_to_copy > 0 ? bytes_to_copy : 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement