mirror of https://github.com/OpenTTD/OpenTTD.git
Fix #9974, aa5a8fe: strftime buffer maxsize is off by one
strftime() return value doesn't count NULL character, but buffer size must include it.
This commit is contained in:
parent
882b8f45d9
commit
e3968cdf65
|
@ -65,7 +65,7 @@ struct Time {
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
return strftime(buffer, last - buffer, format, &time_struct);
|
return strftime(buffer, last - buffer + 1, format, &time_struct);
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
Loading…
Reference in New Issue