Message ID | 20120221.181007.225442485550765553.davem@davemloft.net |
---|---|
State | Not Applicable |
Delegated to: | David Miller |
Headers | show |
From: David Miller <davem@davemloft.net> Date: Tue, 21 Feb 2012 18:10:07 -0500 (EST) > For example, I just found a bug with symlink handling in path > traversal fixed by the following patch. So if there are symlinks > involved in Meelis's setup that would be the cause rather than not > specifically using ext2 for the boot partition. > > -------------------- > ext2: Fix symlink being overwritten. Ignore me, there is no bug. All callers specifically use a special on-stack inode buffer to avoid this problem. -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/second/fs/ext2.c b/second/fs/ext2.c index 710695a..53f2b5e 100644 --- a/second/fs/ext2.c +++ b/second/fs/ext2.c @@ -450,9 +450,11 @@ static char *read_symlink(struct silo_ext2_state *s, struct ext2_inode *ip, char __u32 isize = ext2_to_cpu_32(ip->i_size); if (isize <= 60) - return (char *) &ip->i_block[0]; + strncpy(namebuf, (char *) &ip->i_block[0], isize); + else + read_data(s, ext2_to_cpu_32(ip->i_block[0]), 0, isize, namebuf); - read_data(s, ext2_to_cpu_32(ip->i_block[0]), 0, isize, namebuf); + namebuf[isize] = '\0'; return namebuf; }