summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d8d217c)
This patch is used to fix unspecified address use case in
ConstructSpdIndexer() function. Indexer->Name for
ConstructSpdIndexer is unspecified, that will be a problem
for UnicodeStrToAsciiStr.
This patch also refine the code by removing ASSERT and user
error handling.
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Zeng Star <star.zeng@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
/** @file\r
The implementation of construct ENTRY_INDEXER in IpSecConfig application.\r
\r
/** @file\r
The implementation of construct ENTRY_INDEXER in IpSecConfig application.\r
\r
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
+ return EFI_INVALID_PARAMETER;\r
- ASSERT (ValueStr != NULL);\r
-\r
+ if (ValueStr == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ \r
Value64 = StrToUInteger (ValueStr, &Status);\r
if (!EFI_ERROR (Status)) {\r
Indexer->Index = (UINTN) Value64;\r
Value64 = StrToUInteger (ValueStr, &Status);\r
if (!EFI_ERROR (Status)) {\r
Indexer->Index = (UINTN) Value64;\r
- Indexer->Name = NULL;\r
+ ZeroMem (Indexer->Name, MAX_PEERID_LEN);\r
- UnicodeStrToAsciiStr (ValueStr, (CHAR8 *) Indexer->Name);\r
+ UnicodeStrToAsciiStrS (ValueStr, (CHAR8 *) Indexer->Name, MAX_PEERID_LEN);\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
+ return EFI_INVALID_PARAMETER;\r
- ASSERT (ValueStr != NULL);\r
+ if (ValueStr == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
\r
Value64 = StrToUInteger (ValueStr, &Status);\r
if (!EFI_ERROR (Status)) {\r
\r
Value64 = StrToUInteger (ValueStr, &Status);\r
if (!EFI_ERROR (Status)) {\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
} else if (ShellCommandLineGetFlag (ParamPackage, L"-e")) {\r
ValueStr = ShellCommandLineGetValue (ParamPackage, L"-e");\r
} else {\r
+ return EFI_INVALID_PARAMETER;\r
- ASSERT (ValueStr != NULL);\r
+ if (ValueStr == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
\r
Value64 = StrToUInteger (ValueStr, &Status);\r
\r
\r
Value64 = StrToUInteger (ValueStr, &Status);\r
\r
The internal structure and function declaration to construct ENTRY_INDEXER in\r
IpSecConfig application.\r
\r
The internal structure and function declaration to construct ENTRY_INDEXER in\r
IpSecConfig application.\r
\r
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
#define _INDEXER_H_\r
\r
typedef struct {\r
#define _INDEXER_H_\r
\r
typedef struct {\r
- UINT8 *Name;\r
- UINTN Index; // Used only if Name is NULL.\r
+ UINT8 Name[MAX_PEERID_LEN];\r
+ UINTN Index; // Used only if Name buffer is filled with zero.\r
} SPD_ENTRY_INDEXER;\r
\r
typedef struct {\r
} SPD_ENTRY_INDEXER;\r
\r
typedef struct {\r
/** @file\r
The implementation of match policy entry function in IpSecConfig application.\r
\r
/** @file\r
The implementation of match policy entry function in IpSecConfig application.\r
\r
- Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
BOOLEAN Match;\r
\r
Match = FALSE;\r
BOOLEAN Match;\r
\r
Match = FALSE;\r
- if (Indexer->Name != NULL) {\r
+ if (!IsMemoryZero (Indexer->Name, MAX_PEERID_LEN)) {\r
if ((Data->Name != NULL) && (AsciiStrCmp ((CHAR8 *) Indexer->Name, (CHAR8 *) Data->Name) == 0)) {\r
Match = TRUE;\r
}\r
if ((Data->Name != NULL) && (AsciiStrCmp ((CHAR8 *) Indexer->Name, (CHAR8 *) Data->Name) == 0)) {\r
Match = TRUE;\r
}\r