Browse Source

Fix wrong second parameter in snprintf

bb-10.2-MDEV-14183-aria_pack
Olivier Bertrand 6 years ago
parent
commit
a00b713130
  1. 4
      storage/connect/value.cpp

4
storage/connect/value.cpp

@ -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
/***********************************************************************/ /***********************************************************************/

Loading…
Cancel
Save