[PATCH] Remove lp_posix_pathname() from synthetic_smb_fname_split()

Jeremy Allison jra at samba.org
Thu Mar 10 16:59:11 UTC 2016


On Thu, Mar 10, 2016 at 09:12:53AM +0200, Uri Simchoni wrote:
> A couple of comments:
> 
> In 2/6:
> +	if (lp_posix_pathnames()) {
> +		/* No stream name looked for. */
> +		return synthetic_smb_fname(ctx, fname, NULL, NULL);
> 
> Looks to me like we need psbuf here in the last parameter (sure,
> it's removed one patch later but still... unless I'm missing
> something)

Good catch - fixed !

> In 6/6 last hunk:
>  			if (tmp == NULL) {
>  				status = NT_STATUS_NO_MEMORY;
>  				TALLOC_FREE(fname_dst_parent);
> -				TALLOC_FREE(smb_fname_orig_lcomp);
> +				TALLOC_FREE(orig_lcomp_path);
> +				TALLOC_FREE(orig_lcomp_stream);
>  				goto out;
>  			}
>  			TALLOC_FREE(smb_fname_dst->stream_name);
> -			smb_fname_dst->stream_name = tmp;
> +			smb_fname_dst->stream_name = orig_lcomp_stream;
>                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Do we want that last replacement? looks like use-after-free. We can
> use talloc_steal() if we want to be clever, or just leave it as-is -
> assign recently-allocated tmp.

Yep - should have been left as-is ! Thanks for catching !

> Otherwise RB+ me.

Cheers - pushed & thanks a *LOT* !



More information about the samba-technical mailing list