From 10466746b4083d93af547c153db3730e74c8a3a2 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 20 May 2015 18:18:26 +0000 Subject: (svn r27290) -Fix: sanitize the command line arguments before doing anything complex with them --- src/os/unix/unix.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/os/unix') diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp index 59d40cc89..24dedb2ee 100644 --- a/src/os/unix/unix.cpp +++ b/src/os/unix/unix.cpp @@ -259,7 +259,8 @@ void cocoaReleaseAutoreleasePool(); int CDECL main(int argc, char *argv[]) { - int ret; + /* Make sure our arguments contain only valid UTF-8 characters. */ + for (int i = 0; i < argc; i++) ValidateString(argv[i]); #ifdef WITH_COCOA cocoaSetupAutoreleasePool(); @@ -275,7 +276,7 @@ int CDECL main(int argc, char *argv[]) signal(SIGPIPE, SIG_IGN); - ret = openttd_main(argc, argv); + int ret = openttd_main(argc, argv); #ifdef WITH_COCOA cocoaReleaseAutoreleasePool(); -- cgit v1.2.3-70-g09d2