1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix wrong second parameter in snprintf

This commit is contained in:
Olivier Bertrand
2019-10-16 22:12:47 +02:00
parent b56589eaf2
commit a00b713130

View File

@@ -884,14 +884,14 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
template <class TYPE>
int TYPVAL<TYPE>::ShowValue(char *buf, int len)
{
return snprintf(buf, len, Xfmt, len, Tval);
return snprintf(buf, len + 1, Xfmt, len, Tval);
} // end of ShowValue
template <>
int TYPVAL<double>::ShowValue(char *buf, int len)
{
// TODO: use a more appropriate format to avoid possible truncation
return snprintf(buf, len, Xfmt, len, Prec, Tval);
return snprintf(buf, len + 1, Xfmt, len, Prec, Tval);
} // end of ShowValue
/***********************************************************************/