From 79f1da6bef439b4d283b7b0ecd7707c56c12f986 Mon Sep 17 00:00:00 2001 From: "Rebecca N. Palmer" Date: Fri, 14 Aug 2015 21:37:28 +0100 Subject: [PATCH] Nasal: use SG_LOG for security error messages to avoid truncation These are often too long for naRuntimeError's 128-char limit: http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/55B55856.2030709%40worldwideweb2.nl/#msg34319969 --- src/Scripting/NasalSys.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Scripting/NasalSys.cxx b/src/Scripting/NasalSys.cxx index ca4034f5f..8e7622eae 100644 --- a/src/Scripting/NasalSys.cxx +++ b/src/Scripting/NasalSys.cxx @@ -674,8 +674,11 @@ static naRef f_open(naContext c, naRef me, int argc, naRef* args) std::string filename = fgValidatePath(naStr_data(file), strcmp(modestr, "rb") && strcmp(modestr, "r")); if(filename.empty()) { - naRuntimeError(c, "open(): reading/writing '%s' denied " - "(unauthorized directory - authorization no longer follows symlinks; to authorize reading additional directories, add them to --fg-aircraft)", naStr_data(file)); + SG_LOG(SG_NASAL, SG_ALERT, "open(): reading/writing '" << + naStr_data(file) << "' denied (unauthorized directory - authorization" + " no longer follows symlinks; to authorize reading additional " + "directories, add them to --fg-aircraft)"); + naRuntimeError(c, "open(): access denied (unauthorized directory)"); return naNil(); } f = fopen(filename.c_str(), modestr); @@ -705,8 +708,11 @@ static naRef f_parsexml(naContext c, naRef me, int argc, naRef* args) std::string file = fgValidatePath(naStr_data(args[0]), false); if(file.empty()) { - naRuntimeError(c, "parsexml(): reading '%s' denied " - "(unauthorized directory - authorization no longer follows symlinks; to authorize reading additional directories, add them to --fg-aircraft)", naStr_data(args[0])); + SG_LOG(SG_NASAL, SG_ALERT, "parsexml(): reading '" << + naStr_data(args[0]) << "' denied (unauthorized directory - authorization" + " no longer follows symlinks; to authorize reading additional " + "directories, add them to --fg-aircraft)"); + naRuntimeError(c, "parsexml(): access denied (unauthorized directory)"); return naNil(); } std::ifstream input(file.c_str()); -- 2.39.2