Skip to contentSkip to conversation

ubifs: BUG realpath string must be ended with NULL

PATCH New Ricardo Ribalda Delgado 3 participants 3 messages Apr 27, 2009 UBI file system (UBIFS)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ubifs: BUG realpath string must be ended with NULL

If the memory used to copy the link_make is "dirty" the string wont be ended with NULL, throwing out multiple memory bugs.

---
v3: s/ZERO/NULL/, s/=/ = /
v2: better doc and remove duplicated memcpy

 fs/ubifs/ubifs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/ubifs/ubifs.c +1 -0
index 32f9ff8..427d84a 100644
@@ -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);
 
Signature · 1 line
1.6.2.4
#1 lore raw

PATCH 1/2 ubifs: BUG realpath string must be ended with NULL

Quoted 4 lines · Ricardo Ribalda Delgado

If the memory used to copy the link_make is "dirty" the string wont be ended with NULL, throwing out multiple memory bugs.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#2 lore raw

PATCH 1/2 ubifs: BUG realpath string must be ended with NULL

In reply to Ricardo Ribalda Delgado

Dear Ricardo Ribalda Delgado,

Quoted 7 lines · In message <[email protected]> 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.

---
v3: s/ZERO/NULL/, s/=/ = /
v2: better doc and remove duplicated memcpy

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 9 lines
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
Software entities are more complex for their size  than  perhaps  any
other human construct because no two parts are alike. If they are, we
make  the  two  similar parts into a subroutine -- open or closed. In
this respect, software  systems  differ  profoundly  from  computers,
buildings, or automobiles, where repeated elements abound.
                                                   - Fred Brooks, Jr.