The length calculations in nfs_uri_symlink() omitted space for the
NUL terminator, causing strcpy() to write one byte past the heap
allocation.
Signed-off-by: Theodore Riera <warsang@hotmail.com>
return -EINVAL;
len = strlen ( uri->lookup_pos ) + strlen ( symlink ) - \
- strlen ( uri->mountpoint );
+ strlen ( uri->mountpoint ) + 1;
if ( ! ( new_path = malloc ( len * sizeof ( char ) ) ) )
return -ENOMEM;
strcpy ( new_path + strlen ( new_path ), uri->lookup_pos );
} else {
- len = strlen ( uri->lookup_pos ) + strlen ( symlink );
+ len = strlen ( uri->lookup_pos ) + strlen ( symlink ) + 1;
if ( ! ( new_path = malloc ( len * sizeof ( char ) ) ) )
return -ENOMEM;