summaryrefslogtreecommitdiff
path: root/driver.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-11-28 20:55:16 +0000
committerDarkvater <darkvater@openttd.org>2006-11-28 20:55:16 +0000
commit7c945bf8283d381ebf7982377b639f163f23a1ea (patch)
tree5c4e14a6ee9c764ba23ada2a4c72dcc0ade951c2 /driver.c
parentdcbbda0cb9674e8fc9aaa64a0861fd6381ae4202 (diff)
downloadopenttd-7c945bf8283d381ebf7982377b639f163f23a1ea.tar.xz
(svn r7280) -Codechange: Replace some sprintf() functions with the safer snprintf() functions
Diffstat (limited to 'driver.c')
-rw-r--r--driver.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/driver.c b/driver.c
index 7b1447973..58a94d982 100644
--- a/driver.c
+++ b/driver.c
@@ -206,18 +206,18 @@ int GetDriverParamInt(const char* const* parm, const char* name, int def)
}
-char *GetDriverList(char* p)
+char *GetDriverList(char* p, const char *last)
{
const DriverClass* dc;
for (dc = _driver_classes; dc != endof(_driver_classes); dc++) {
const DriverDesc* dd;
- p += sprintf(p, "List of %s drivers:\n", dc->name);
+ p += snprintf(p, last - p, "List of %s drivers:\n", dc->name);
for (dd = dc->descs; dd->name != NULL; dd++) {
- p += sprintf(p, "%10s: %s\n", dd->name, dd->longname);
+ p += snprintf(p, last - p, "%10s: %s\n", dd->name, dd->longname);
}
- p += sprintf(p, "\n");
+ p = strecpy(p, "\n", last);
}
return p;