addressed amb1230 - BfReadString() erroring on something that should be perfectly valid

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401756
This commit is contained in:
David Anderson
2007-12-03 03:19:21 +00:00
parent 6533e16019
commit dcb77e0918
3 changed files with 328 additions and 316 deletions
+6 -3
View File
@@ -484,6 +484,7 @@ static cell_t smn_BfReadString(IPluginContext *pCtx, const cell_t *params)
HandleError herr;
HandleSecurity sec;
bf_read *pBitBuf;
int numChars = 0;
char *buf;
sec.pOwner = NULL;
@@ -496,12 +497,14 @@ static cell_t smn_BfReadString(IPluginContext *pCtx, const cell_t *params)
}
pCtx->LocalToPhysAddr(params[2], (cell_t **)&buf);
if (!pBitBuf->ReadString(buf, params[3], params[4] ? true : false))
pBitBuf->ReadString(buf, params[3], params[4], &numChars);
if (pBitBuf->IsOverflowed())
{
return pCtx->ThrowNativeError("Destination string buffer is too short, try increasing its size");
return -numChars - 1;
}
return 1;
return numChars;
}
static cell_t smn_BfReadEntity(IPluginContext *pCtx, const cell_t *params)