On 10/10/12 19:42, Daniel Lehman wrote: + memcpy_s(*to_next, MB_LEN_MAX, buf, size); You may use memory after to_end in this code. to_next buffer size should be probably following: memcpy_s(*to_next, to_end-to_next, buf, size); Cheers, Piotr