From 71e705034943e79ea45ecc66d7ba32c581daba35 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 14 Jun 2021 13:52:22 +0100 Subject: [PATCH] Attempt to fix realpath() recursion Sentry-Id: FLIGHTGEAR-D6W --- simgear/misc/sg_path.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 9e74bafc..1bac4a2b 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -48,6 +48,7 @@ #endif #include "sg_path.hxx" +#include using std::string; using simgear::strutils::starts_with; @@ -995,8 +996,9 @@ SGPath SGPath::realpath() const // (needed for fgValidatePath security) { if (path.empty()) { - return SGPath(".").realpath(); // current directory + return simgear::Dir::current().path(); } + std::string this_dir = dir(); if (isAbsolute() && this_dir.empty()) { // top level this_dir = "/";