Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool

2017-11-05 Thread Wang, Jian J
Wang, Jian J ; edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Bi, Dandan > Subject: Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool > > 2 comments below. > > -Original Message- > From: Wang, Jian J > Sent: Friday, November 3, 2017 12:58 PM > To

Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool

2017-11-05 Thread Wang, Jian J
Ruiyu, Thanks for the comments. > -Original Message- > From: Ni, Ruiyu > Sent: Friday, November 03, 2017 4:23 PM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Carsey, Jaben ; Bi, Dandan > Subject: RE: [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool > > 2 comments below. > >

Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool

2017-11-03 Thread Jim.Dailey
Of Ni, Ruiyu Sent: Friday, November 3, 2017 3:23 AM To: Wang, Jian J ; edk2-devel@lists.01.org Cc: Carsey, Jaben ; Bi, Dandan Subject: Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool 2 comments below. -Original Message- From: Wang, Jian J Sent: Friday, November 3, 2017 12:

Re: [edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool

2017-11-03 Thread Ni, Ruiyu
2 comments below. -Original Message- From: Wang, Jian J Sent: Friday, November 3, 2017 12:58 PM To: edk2-devel@lists.01.org Cc: Carsey, Jaben ; Ni, Ruiyu ; Bi, Dandan Subject: [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool AllocateCopyPool(AllocationSize, *Buffer) will copy "All

[edk2] [PATCH 2/3] ShellPkg: Fix misuses of AllocateCopyPool

2017-11-02 Thread Jian J Wang
AllocateCopyPool(AllocationSize, *Buffer) will copy "AllocationSize" bytes of memory from old "Buffer" to new allocated one. If "AllocationSize" is bigger than size of "Buffer", heap memory overflow occurs during copy. The solution is to allocate pool first then copy the necessary bytes to new mem