Skip to content

Commit

Permalink
Careful to not construct string from NULL pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
theurich committed Feb 21, 2025
1 parent 0e505ea commit 9750556
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Infrastructure/VM/src/ESMCI_VMKernel.C
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,10 @@ void *VMK::startup(class VMKPlan *vmp, void *(fctp)(void *, void *),
sarg[i].cargo = cargo;
// stdout and stderr redirect
string stdTemp; size_t pos; // temp helpers
stdTemp = string(vmp->stdoutName);
if (vmp->stdoutName)
stdTemp = string(vmp->stdoutName);
else
stdTemp = string("");
pos = stdTemp.rfind('*'); // right most asterisk
if (pos != string::npos){
// found wildcard -> replace with local pet number
Expand All @@ -2554,7 +2557,10 @@ void *VMK::startup(class VMKPlan *vmp, void *(fctp)(void *, void *),
// no wildcard -> use incoming string verbatim
sarg[i].stdoutName = stdTemp;
}
stdTemp = string(vmp->stderrName);
if (vmp->stderrName)
stdTemp = string(vmp->stderrName);
else
stdTemp = string("");
pos = stdTemp.rfind('*'); // right most asterisk
if (pos != string::npos){
// found wildcard -> replace with local pet number
Expand Down

0 comments on commit 9750556

Please sign in to comment.