From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
Date: Wed, 19 Apr 2017 18:18:15 +0800 [thread overview]
Message-ID: <1492597098-35836-2-git-send-email-yonghong.zhu@intel.com> (raw)
In-Reply-To: <1492597098-35836-1-git-send-email-yonghong.zhu@intel.com>
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>
---
BaseTools/Source/C/VolInfo/VolInfo.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index eff5f9e..a695529 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -329,11 +329,14 @@ Returns:
OpenSslCommand = "openssl";
OpenSslEnv = getenv("OPENSSL_PATH");
if (OpenSslEnv == NULL) {
OpenSslPath = OpenSslCommand;
} 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) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return GetUtilityStatus ();
}
CombinePath(OpenSslEnv, OpenSslCommand, OpenSslPath);
@@ -1589,15 +1592,16 @@ CombinePath (
OUT CHAR8* NewPath
)
{
UINT32 DefaultPathLen;
UINT64 Index;
-
+ CHAR8 QuotesStr[] = "\"";
+ strcpy(NewPath, QuotesStr);
DefaultPathLen = strlen(DefaultPath);
- strcpy(NewPath, DefaultPath);
+ strcat(NewPath, DefaultPath);
Index = 0;
- for (; Index < DefaultPathLen; Index ++) {
+ for (; Index < DefaultPathLen + 1; Index ++) {
if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
if (NewPath[Index + 1] != '\0') {
NewPath[Index] = '/';
}
}
@@ -1605,10 +1609,11 @@ CombinePath (
if (NewPath[Index -1] != '/') {
NewPath[Index] = '/';
NewPath[Index + 1] = '\0';
}
strcat(NewPath, AppendPath);
+ strcat(NewPath, QuotesStr);
return EFI_SUCCESS;
}
EFI_STATUS
ParseSection (
--
2.6.1.windows.1
next prev parent reply other threads:[~2017-04-19 10:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
2017-04-19 10:18 ` Yonghong Zhu [this message]
2017-04-19 10:18 ` [Patch 2/4] BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space Yonghong Zhu
2017-04-19 10:18 ` [Patch 3/4] BaseTools: Rsa2048Sha256Sign " Yonghong Zhu
2017-04-19 10:18 ` [Patch 4/4] BaseTools: Rsa2048Sha256GenerateKeys " Yonghong Zhu
2017-04-27 9:31 ` [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492597098-35836-2-git-send-email-yonghong.zhu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox