Re: [PATCH] libmount: fix merge_optstr (do not truncate 3 trailing characters)

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

 



Am 04.07.2010 20:02, schrieb Petr Uzel:
> I believe this is the correct fix.
> 
> Signed-off-by: Petr Uzel <petr.uzel-aRb0bU7PRFPrBKCeMvbIDA@xxxxxxxxxxxxxxxx>
> ---
>  shlibs/mount/src/tab_parse.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c
> index 5dbcfa6..680e1fc 100644
> --- a/shlibs/mount/src/tab_parse.c
> +++ b/shlibs/mount/src/tab_parse.c
> @@ -254,7 +254,8 @@ static char *merge_optstr(const char *vfs, const char *fs)
>  	if (!strcmp(vfs, fs))
>  		return strdup(vfs);		/* e.g. "aaa" and "aaa" */
>  
> -	sz = strlen(vfs) + strlen(fs) + 2;
> +	/* leave space for leading "r[ow],", "," and trailing zero */
> +	sz = strlen(vfs) + strlen(fs) + 5;
>  	res = malloc(sz);
>  	if (!res)
>  		return NULL;

This seems to work perfectly, thanks for the quick reply and fix.
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux