]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 19 Apr 2017 09:50:00 +0000 (17:50 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Thu, 27 Apr 2017 13:18:33 +0000 (21:18 +0800)
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>
BaseTools/Source/C/VolInfo/VolInfo.c

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