Mercurial > hg > openttd
changeset 469:23664f1bc31a draft
(svn r702) -Fix: Buffer overflow in music/sound/video-driver-parameter (Oskar_)
author | truelight <truelight@openttd.org> |
---|---|
date | Sat, 20 Nov 2004 11:15:31 +0000 |
parents | bc0196b2a135 |
children | 730de2a17a6e |
files | ttd.c |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ttd.c +++ b/ttd.c @@ -480,7 +480,7 @@ 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 @@ 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;