The number returned by vsnprintf contains the actual number of characters. If the message was smaller than the estimated size. It would've created a string with garbage after the null character.

This commit is contained in:
Sandu Liviu Catalin
2019-04-23 23:41:32 +03:00
parent bc126fd0ab
commit 235fcd9be7

View File

@ -1146,7 +1146,7 @@ begin:
} else if (r<0) {
v->_lasterror=SQString::Create(_ss(v),_SC("@failed to generate formatted error message"));
} else {
v->_lasterror=SQString::Create(_ss(v),b,n);
v->_lasterror=SQString::Create(_ss(v),b,r);
}
return SQ_ERROR;
}