BaseTools/VolInfo: Update OPENSSL_PATH to support space characters

Update OPENSSL_PATH handling to support space characters in the Path.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2017-04-19 17:50:00 +08:00
parent 91048b0df6
commit 3337eefb49
1 changed files with 9 additions and 4 deletions

View File

@ -331,7 +331,10 @@ Returns:
if (OpenSslEnv == NULL) { if (OpenSslEnv == NULL) {
OpenSslPath = OpenSslCommand; OpenSslPath = OpenSslCommand;
} else { } else {
OpenSslPath = malloc(strlen(OpenSslEnv)+strlen(OpenSslCommand)+1); //
// We add quotes to the Openssl Path in case it has space characters
//
OpenSslPath = malloc(2+strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);
if (OpenSslPath == NULL) { if (OpenSslPath == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return GetUtilityStatus (); return GetUtilityStatus ();
@ -1591,11 +1594,12 @@ CombinePath (
{ {
UINT32 DefaultPathLen; UINT32 DefaultPathLen;
UINT64 Index; UINT64 Index;
CHAR8 QuotesStr[] = "\"";
strcpy(NewPath, QuotesStr);
DefaultPathLen = strlen(DefaultPath); DefaultPathLen = strlen(DefaultPath);
strcpy(NewPath, DefaultPath); strcat(NewPath, DefaultPath);
Index = 0; Index = 0;
for (; Index < DefaultPathLen; Index ++) { for (; Index < DefaultPathLen + 1; Index ++) {
if (NewPath[Index] == '\\' || NewPath[Index] == '/') { if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
if (NewPath[Index + 1] != '\0') { if (NewPath[Index + 1] != '\0') {
NewPath[Index] = '/'; NewPath[Index] = '/';
@ -1607,6 +1611,7 @@ CombinePath (
NewPath[Index + 1] = '\0'; NewPath[Index + 1] = '\0';
} }
strcat(NewPath, AppendPath); strcat(NewPath, AppendPath);
strcat(NewPath, QuotesStr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }