From 235fcd9be7840322e1cbe82f19478a5c030b31bd Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Tue, 23 Apr 2019 23:41:32 +0300 Subject: [PATCH] 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. --- squirrel/sqapi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squirrel/sqapi.cpp b/squirrel/sqapi.cpp index c78a653..11f751e 100644 --- a/squirrel/sqapi.cpp +++ b/squirrel/sqapi.cpp @@ -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; }