diff options
author | truelight <truelight@openttd.org> | 2006-01-06 22:52:31 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-01-06 22:52:31 +0000 |
commit | 835cd6ea2897fed19bcdbdf5f237102a22065502 (patch) | |
tree | bcbe71fd499d92db668ecf04b5e0a41fd2226d96 /openttd.c | |
parent | 79ce0def50f4d2c3e9956c9a5e7c93d893c1f465 (diff) | |
download | openttd-835cd6ea2897fed19bcdbdf5f237102a22065502.tar.xz |
(svn r3379) -Fix: protect showhelp against any possible overflow
-Add: [ FS#15 ] Added revision / version at top of help (./openttd -h)
Diffstat (limited to 'openttd.c')
-rw-r--r-- | openttd.c | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -115,11 +115,21 @@ void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize) return mem; } +extern const char _openttd_revision[]; + static void showhelp(void) { char buf[4096], *p; + int size, pos; + + p = buf; + size = sizeof(buf); - p = strecpy(buf, + pos = snprintf(p, size, "OpenTTD %s\n", _openttd_revision); + p += pos; size -= pos; + pos = snprintf(p, size, + "\n" + "\n" "Command line options:\n" " -v drv = Set video driver (see below)\n" " -s drv = Set sound driver (see below)\n" @@ -136,13 +146,14 @@ static void showhelp(void) #if !defined(__MORPHOS__) && !defined(__AMIGA__) " -f = Fork into the background (dedicated only)\n" #endif - " -i = Force to use the DOS palette (use this if you see a lot of pink)\n" - " -p #player = Player as #player (deprecated) (network only)\n" - " -c config_file = Use 'config_file' instead of 'openttd.cfg'\n", - lastof(buf) + " -i = Force to use the DOS palette\n" + " (use this if you see a lot of pink)\n" + " -c config_file = Use 'config_file' instead of 'openttd.cfg'\n" + "\n" ); + p += pos; size -= pos; - GetDriverList(p); + size = GetDriverList(p, size); ShowInfo(buf); } |