The 'size' operand of memcpy() does not indicate the length of the
opts array; it is the size of the resulting array once the opts array
is concatenated with the options being added in this function. This
results in out-of-bound read(s) in the opts array.
Use 'sizeof(char *) * opts_len' as the length to copy at the beginning
of the resulting array.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
goto error;
}
- memcpy(argv, opts, size);
+ memcpy(argv, opts, sizeof(char *) * opts_len);
if (session_live_mode) {
argv[opts_len] = "-i";