diff options
author | rubidium <rubidium@openttd.org> | 2015-05-20 18:18:26 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2015-05-20 18:18:26 +0000 |
commit | 10466746b4083d93af547c153db3730e74c8a3a2 (patch) | |
tree | 8b316537337fedf6d7f8cfef7e5374cbc58520e5 /src/os/unix | |
parent | d05ac99d52e8051a5ec75393863b44cca17306b3 (diff) | |
download | openttd-10466746b4083d93af547c153db3730e74c8a3a2.tar.xz |
(svn r27290) -Fix: sanitize the command line arguments before doing anything complex with them
Diffstat (limited to 'src/os/unix')
-rw-r--r-- | src/os/unix/unix.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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(); |