Fix buffer growth in sockets/conversion.c

memset() the *end* of the new buffer, not the beginning
Copy the pointer to the buffer, not its initial contents

Fixes bug 69619
This commit is contained in:
Sara Golemon 2015-06-17 13:26:48 -07:00
parent 61d58f2d9e
commit d241711f44

View file

@ -910,8 +910,8 @@ static void from_zval_write_control(const zval *arr,
if (space_left < req_space) {
*control_buf = safe_erealloc(*control_buf, 2, req_space, *control_len);
*control_len += 2 * req_space;
memset(*control_buf, '\0', *control_len - *offset);
memcpy(&alloc->data, *control_buf, sizeof *control_buf);
memset(*control_buf + *offset, '\0', *control_len - *offset);
memcpy(&alloc->data, control_buf, sizeof *control_buf);
}
cmsghdr = (struct cmsghdr*)(((char*)*control_buf) + *offset);