[
https://issues.apache.org/jira/browse/GEODE-9405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17372584#comment-17372584
]
ASF GitHub Bot commented on GEODE-9405:
---------------------------------------
gaussianrecurrence commented on a change in pull request #826:
URL: https://github.com/apache/geode-native/pull/826#discussion_r662139036
##########
File path: cppcache/integration-test/ThinClientSecurityHelper.hpp
##########
@@ -59,13 +59,15 @@ const char* regionNamesAuth[] = {"DistRegionAck"};
std::shared_ptr<CredentialGenerator> credentialGeneratorHandler;
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char* path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Be careful when assigning the output of std::getenv to an std::string.
If the env var is not defined it will return a nullptr, and passing a nullptr
to a std::string constructor result in a coredump. There is an utility function
Utils::getEnv which acts safely by returning an empty string when the variable
is not defined.
##########
File path: cppcache/integration-test/testThinClientSecurityAuthentication.cpp
##########
@@ -34,13 +34,15 @@ const char *regionNamesAuth[] = {"DistRegionAck",
"DistRegionNoAck"};
std::shared_ptr<CredentialGenerator> credentialGeneratorHandler;
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path:
cppcache/integration-test/testThinClientSecurityAuthenticationSetAuthInitialize.cpp
##########
@@ -35,13 +35,15 @@ const char *regionNamesAuth[] = {"DistRegionAck",
"DistRegionNoAck"};
std::shared_ptr<CredentialGenerator> credentialGeneratorHandler;
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != NULL,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path: cppcache/integration-test/testThinClientSecurityAuthorization.cpp
##########
@@ -54,13 +54,15 @@ const std::string locHostPort =
std::shared_ptr<CredentialGenerator> credentialGeneratorHandler;
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path: cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
##########
@@ -65,13 +65,15 @@ std::shared_ptr<CredentialGenerator>
credentialGeneratorHandler;
const char *exFuncNameSendException = "executeFunction_SendException";
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path: cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
##########
@@ -138,13 +138,15 @@ class MyCqListener : public CqListener {
};
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path:
cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
##########
@@ -139,13 +139,15 @@ class MyCqListener : public CqListener {
};
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
##########
File path: cppcache/integration-test/testThinClientWriterException.cpp
##########
@@ -52,13 +52,15 @@ const char *regionNamesAuth[] = {"DistRegionAck"};
std::shared_ptr<CredentialGenerator> credentialGeneratorHandler;
std::string getXmlPath() {
- char xmlPath[1000] = {'\0'};
- const char *path = std::getenv("TESTSRC");
- ASSERT(path != nullptr,
+ std::string path = std::string(std::getenv("TESTSRC"));
Review comment:
Same comment as above regarding code safety for std::getenv
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Build fails on rhel-8 release
> -----------------------------
>
> Key: GEODE-9405
> URL: https://issues.apache.org/jira/browse/GEODE-9405
> Project: Geode
> Issue Type: Bug
> Components: native client
> Reporter: Michael Martell
> Priority: Major
> Labels: pull-request-available
>
> Looks like a recent gcc compiler change on rhel-8 is causing build failures
> in the CI.
> Looks to be related to unsafe use of strncpy in a few of our legacy C++ tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)