Hi Shumin
Can we use below? I do not think we need call StrSize twice.

EnvNameSize = StrSize(EnvName);
EnvFileInterface = AllocateZeroPool(sizeof(EFI_FILE_PROTOCOL_ENVIRONMENT)+ 
EnvNameSize);

Thank you
Yao Jiewen

From: Qiu, Shumin [mailto:[email protected]]
Sent: Monday, September 08, 2014 10:40 PM
To: Carsey, Jaben
Cc: [email protected]
Subject: [edk2] [Patch]ShellPkg: Replace the usage of StrnCpy with CopyMem to 
avoid potential buffer overflow and refine the code style.

Hi Jaben,
Can you help to review the patch?  To make code in an obviously-no-error way, 
we shall not use StrLen(Source) as the third param for function "StrnCpy (Dest, 
Source, Length)". So we use CopyMem to replace it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]<mailto:[email protected]>>
Signed-off-by: Yao Jiewen <[email protected]<mailto:[email protected]>>


Thanks
Shumin

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to