commit | 788d96ed1aa4adee7404cc0eb58b06be98b7cf0a | [log] [tgz] |
---|---|---|
author | Ed Tanous <edtanous@google.com> | Mon Jan 25 13:12:07 2021 -0800 |
committer | Tom Joseph <tomjoseph@in.ibm.com> | Wed Jan 27 08:47:55 2021 +0000 |
tree | 382f17fc2fe75c51986d3472287238411d71c1d9 | |
parent | e7e46f58f1870bd46114bec316c4d770e2053d72 [diff] |
Remove undefined behavior The commit here: https://gerrit.openbmc-project.xyz/c/openbmc/meta-phosphor/+/39481 Located this issue. open needs to be called with permissions, otherwise it results in undefined behavior. Tested: Code now compiles with security flags enabled. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I597c5dff37a4e89af9a68f264782ada973c70622
diff --git a/oem/ibm/libpldmresponder/file_io_type_cert.cpp b/oem/ibm/libpldmresponder/file_io_type_cert.cpp index b49903c..f21cdf2 100644 --- a/oem/ibm/libpldmresponder/file_io_type_cert.cpp +++ b/oem/ibm/libpldmresponder/file_io_type_cert.cpp
@@ -116,11 +116,11 @@ } if (certType == PLDM_FILE_TYPE_SIGNED_CERT) { - fileFd = open(clientCertPath, flags); + fileFd = open(clientCertPath, flags, S_IRUSR | S_IWUSR); } else if (certType == PLDM_FILE_TYPE_ROOT_CERT) { - fileFd = open(rootCertPath, flags); + fileFd = open(rootCertPath, flags, S_IRUSR | S_IWUSR); } if (fileFd == -1) {