[U-Boot] [PATCH 1/3] ubifs: BUG realpath string must be ended with NULL

Wolfgang Denk wd at denx.de
Mon Apr 27 14:32:20 CEST 2009


Dear Ricardo Ribalda Delgado,

In message <1240831297-15862-1-git-send-email-ricardo.ribalda at uam.es> you wrote:
> If the memory used to copy the link_make is "dirty" the string wont
> be ended with NULL, throwing out multiple memory bugs.

What is "link_make" ? Do you mean "link_name" ?

> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda at uam.es>
> ---
>  fs/ubifs/ubifs.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
> index 32f9ff8..427d84a 100644
> --- a/fs/ubifs/ubifs.c
> +++ b/fs/ubifs/ubifs.c
> @@ -641,6 +641,7 @@ int ubifs_load(char *filename, u32 addr, u32 size)
>  	ui = ubifs_inode(inode);
>  	if (((inode->i_mode & S_IFMT) == S_IFLNK) && ui->data_len) {
>  		memcpy(link_name, ui->data, ui->data_len);
> +		link_name[ui->data_len] = '\0';
>  		printf("%s is linked to %s!\n", filename, link_name);
>  		ubifs_iput(inode);
>  
> -- 
> 1.6.2.4
> 
> 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Unix is like a toll road on which you have to stop every 50  feet  to
pay another nickel. But hey! You only feel 5 cents poorer each time.
                 - Larry Wall in <1992Aug13.192357.15731 at netlabs.com>


More information about the U-Boot mailing list