Perform range check before allocating memory when reading

extended attributes.

Reviewed by:	kib
Approved by:	re (hrs)
PR:		114389
This commit is contained in:
Craig Rodrigues 2007-07-13 18:51:08 +00:00
parent f24f2810ce
commit 7a920f5761
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171437

View file

@ -1192,14 +1192,18 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra)
{
struct inode *ip;
struct ufs2_dinode *dp;
struct fs *fs;
struct uio luio;
struct iovec liovec;
int easize, error;
u_char *eae;
ip = VTOI(vp);
fs = ip->i_fs;
dp = ip->i_din2;
easize = dp->di_extsize;
if ((uoff_t)easize + extra > NXADDR * fs->fs_bsize)
return (EFBIG);
eae = malloc(easize + extra, M_TEMP, M_WAITOK);