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]


Reply via email to