Re: [edk2] [PATCH 1/3] MdeModulePkg: Fix misuses of AllocateCopyPool

2017-11-05 Thread Wang, Jian J
Star, Thanks for the comments. It's a good suggestion. I didn't know ReallocatePool() can do that. Thanks Jian > -Original Message- > From: Zeng, Star > Sent: Friday, November 03, 2017 5:14 PM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Dong, Eric

[edk2] [PATCH 1/3] MdeModulePkg: 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