Re: [PATCH 2/2] nfs-utils: mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/02/2015 06:16 AM, Vivek Trivedi wrote:
> In function nfs_parse_simple_hostname, hostname can be NULL,
> dereferncing it while passing it to free(*hostname) may result in segfault.
> 
> Signed-off-by: Vivek Trivedi <t.vivek@xxxxxxxxxxx>
Committed... 

steved.

> ---
>  utils/mount/parse_dev.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
> index d64b83d..0d3bcb9 100644
> --- a/utils/mount/parse_dev.c
> +++ b/utils/mount/parse_dev.c
> @@ -118,7 +118,8 @@ static int nfs_parse_simple_hostname(const char *dev,
>  	if (pathname) {
>  		*pathname = strndup(colon, path_len);
>  		if (*pathname == NULL) {
> -			free(*hostname);
> +			if (hostname)
> +				free(*hostname);
>  			return nfs_pdn_nomem_err();
>  		}
>  	}
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux