Commit a00b7131 authored by Olivier Bertrand's avatar Olivier Bertrand

Fix wrong second parameter in snprintf

parent b56589ea
...@@ -884,14 +884,14 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go) ...@@ -884,14 +884,14 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go)
template <class TYPE> template <class TYPE>
int TYPVAL<TYPE>::ShowValue(char *buf, int len) 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 } // end of ShowValue
template <> template <>
int TYPVAL<double>::ShowValue(char *buf, int len) int TYPVAL<double>::ShowValue(char *buf, int len)
{ {
// TODO: use a more appropriate format to avoid possible truncation // 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 } // end of ShowValue
/***********************************************************************/ /***********************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment