mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-23 10:14:55 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171437
|
@ -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…
Reference in a new issue