On 07/31/13 04:11, Gary Ching-Pang Lin wrote: > On Tue, Jul 30, 2013 at 01:36:16PM +0200, Laszlo Ersek wrote: >> On 07/30/13 11:23, Gary Ching-Pang Lin wrote: >>> When enrolling the certificate from a file, the suffix check function >>> check the last 4 characters to filter out non-DER files. However, >>> if the length of the file name is less than 4, the address prior to >>> the file name will be accessed while it shouldn't. This commit checks >>> the length of the file name to avoid illegal access. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Gary Ching-Pang Lin <g...@suse.com> >>> --- >>> .../SecureBootConfigDxe/SecureBootConfigImpl.c | 21 >>> ++++++++++++++++++--- >>> 1 file changed, 18 insertions(+), 3 deletions(-) >>> >>> diff --git >>> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c >>> >>> b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c >>> index e8beecb..f5e899f 100644 >>> --- >>> a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c >>> +++ >>> b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c >>> @@ -399,6 +399,7 @@ EnrollPlatformKey ( >>> UINTN DataSize; >>> EFI_SIGNATURE_LIST *PkCert; >>> UINT16* FilePostFix; >>> + UINTN NameLength; >>> >>> if (Private->FileContext->FileName == NULL) { >>> return EFI_INVALID_PARAMETER; >>> @@ -414,7 +415,11 @@ EnrollPlatformKey ( >>> // >>> // Parse the file's postfix. Only support DER encoded X.509 certificate >>> files. >>> // >>> - FilePostFix = Private->FileContext->FileName + StrLen >>> (Private->FileContext->FileName) - 4; >>> + NameLength = StrLen (Private->FileContext->FileName); >>> + if (NameLength <= 4) { >> >> By including equality in this condition, you'll refuse a file named >> '.DER'. Maybe that's a good thing, but technically '.DER' does end in >> '.DER' :) >> > The files prefixed '.' are hidden files in UNIX/Linux world. > I exclude '.DER' for that reason though it belongs to '*.DER'. > Besides, it's the certificate to be enrolled into PK, KEK, or db, and > the file name is better to be identifiable. '.DER' is not a meaningful > name in this case.
Fair enough. Laszlo ------------------------------------------------------------------------------ Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel