From a97da2c607517551faef928353813b8456bfcc53 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sun, 30 Nov 2008 13:33:02 -0600 Subject: Fixed passing nonliteral strings to *printf functions. gcc 4.3 rejects that as being unsafe. Patch by Stephen Zenith. [#11] --- ChangeLog.txt | 12 ++++++++++++ linden/indra/linux_crash_logger/llcrashloggerlinux.cpp | 2 +- linden/indra/llwindow/llwindowsdl.cpp | 2 +- linden/indra/lscript/lscript_compile/lscript_tree.cpp | 8 ++++---- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 88829c9..2e4f19b 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,15 @@ +2008-11-30 Jacek Antonelli + + * linden/indra/llwindow/llwindowsdl.cpp: + Fixed passing nonliteral strings to *printf functions. + gcc 4.3 rejects that as being unsafe. + Patch by Stephen Zenith. [#11] + * linden/indra/linux_crash_logger/llcrashloggerlinux.cpp: + Ditto. + * linden/indra/lscript/lscript_compile/lscript_tree.cpp: + Ditto. + + 2008-11-29 Jacek Antonelli * linden/indra/newview/llpanellogin.cpp: diff --git a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp index 6ac9831..c4294d6 100644 --- a/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/linden/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -90,7 +90,7 @@ static BOOL do_ask_dialog(void) win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, - dialog_text); + "%s", dialog_text); gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_title(GTK_WINDOW(win), dialog_title); diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index c088dd8..f0acee5 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp @@ -2530,7 +2530,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ buttons = GTK_BUTTONS_YES_NO; break; } - win = gtk_message_dialog_new(NULL,flags, messagetype, buttons, text.c_str()); + win = gtk_message_dialog_new(NULL,flags, messagetype, buttons, "%s", text.c_str()); # if LL_X11 // Make GTK tell the window manager to associate this diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.cpp b/linden/indra/lscript/lscript_compile/lscript_tree.cpp index 71e7f19..70d8195 100644 --- a/linden/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/linden/indra/lscript/lscript_compile/lscript_tree.cpp @@ -7885,10 +7885,10 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { // Prefix function name with g to distinguish from // event handlers. - fprintf(fp, gScriptp->getClassName()); + fprintf(fp, "%s", gScriptp->getClassName()); fprintf(fp, "::'g"); } - fprintf(fp, mIdentifier->mName); + fprintf(fp, "%s", mIdentifier->mName); fprintf(fp, "'("); print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs); fprintf(fp, ")\n"); @@ -9720,7 +9720,7 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom // Allows state changing by finding handlers prefixed with new // state name. Prefix disambiguates functions and event handlers. fprintf(fp, "e"); - fprintf(fp, entry->mIdentifier); + fprintf(fp, "%s", entry->mIdentifier); // Handler name and arguments. mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -10152,7 +10152,7 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT fprintf(fp, ".method public hidebysig instance default "); print_cil_type(fp, mType ? mType->mType : LST_NULL); fprintf(fp, " 'g"); - fprintf(fp, mIdentifier->mName); + fprintf(fp, "%s", mIdentifier->mName); fprintf(fp, "'"); if (mParameters) { -- cgit v1.1