Perform range check before allocating memory when reading
extended attributes. Reviewed by: kib Approved by: re (hrs) PR: 114389
This commit is contained in:
parent
f24f2810ce
commit
7a920f5761
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user