Skip to content

Commit

Permalink
exceptionhandler.cpp: Fix possible crash if popen fails
Browse files Browse the repository at this point in the history
Co-Authored-By: etbe <[email protected]>
  • Loading branch information
past-due and etbe committed Jul 9, 2023
1 parent 60d4ebc commit 5d4634a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/exceptionhandler/exceptionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,11 @@ static bool fetchProgramPath(char *const output_programPath, size_t const bufSiz
* output in output_programPath.
*/
whichProgramStream = popen(whichProgramCommand, "r");
if(!whichProgramStream)
{
debug(LOG_WARNING, "failed to popen which");
return false;
}
bytesRead = fread(output_programPath, 1, bufSize, whichProgramStream);
pclose(whichProgramStream);

Expand Down

0 comments on commit 5d4634a

Please sign in to comment.