summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-11-20 11:15:31 +0000
committertruelight <truelight@openttd.org>2004-11-20 11:15:31 +0000
commit32f69dab0e09d902a73990acdc74d36180b67993 (patch)
tree4b62ad10be16149cdf304e65811acf6c34272a26
parent578bde9aaef23287b43286878ea9c54b873e362c (diff)
downloadopenttd-32f69dab0e09d902a73990acdc74d36180b67993.tar.xz
(svn r702) -Fix: Buffer overflow in music/sound/video-driver-parameter (Oskar_)
-rw-r--r--ttd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ttd.c b/ttd.c
index aef3ac55a..1393d4d0f 100644
--- a/ttd.c
+++ b/ttd.c
@@ -480,7 +480,7 @@ int ttd_main(int argc, char* argv[])
int network = 0;
char *network_conn = NULL;
char *language = NULL;
- char musicdriver[32], sounddriver[32], videodriver[32];
+ char musicdriver[16], sounddriver[16], videodriver[16];
int resolution[2] = {0,0};
uint startdate = -1;
_ignore_wrong_grf = false;
@@ -549,9 +549,9 @@ int ttd_main(int argc, char* argv[])
LoadFromConfig();
// override config?
- if (musicdriver[0]) strcpy(_ini_musicdriver, musicdriver);
- if (sounddriver[0]) strcpy(_ini_sounddriver, sounddriver);
- if (videodriver[0]) strcpy(_ini_videodriver, videodriver);
+ if (musicdriver[0]) ttd_strlcpy(_ini_musicdriver, musicdriver, sizeof(_ini_musicdriver));
+ if (sounddriver[0]) ttd_strlcpy(_ini_sounddriver, sounddriver, sizeof(_ini_sounddriver));
+ if (videodriver[0]) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
if (resolution[0]) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; }
if (startdate != -1) _patches.starting_date = startdate;