[Scummvm-git-logs] scummvm master -> 530d497f237cbbc73aa3016790f2a4e7129a8baa
Strangerke
noreply at scummvm.org
Thu May 16 07:22:04 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
530d497f23 BAGEL: Verify the return value of a strchr to avoir a null dereferencing (CID 1544836)
Commit: 530d497f237cbbc73aa3016790f2a4e7129a8baa
https://github.com/scummvm/scummvm/commit/530d497f237cbbc73aa3016790f2a4e7129a8baa
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-16T08:21:56+01:00
Commit Message:
BAGEL: Verify the return value of a strchr to avoir a null dereferencing (CID 1544836)
Changed paths:
engines/bagel/boflib/res.cpp
diff --git a/engines/bagel/boflib/res.cpp b/engines/bagel/boflib/res.cpp
index d24dde27ae0..efc778b8855 100644
--- a/engines/bagel/boflib/res.cpp
+++ b/engines/bagel/boflib/res.cpp
@@ -55,7 +55,7 @@ ErrorCode CBofStringTable::load(const char *pszFileName) {
// Allocate a buffer to hold entire file
_pBuf = (byte *)bofAlloc(_lBufSize + 1);
if (_pBuf == nullptr)
- fatalError(ERR_MEMORY, "Unable to allocate %u bytes for String Table", _lBufSize);
+ fatalError(ERR_MEMORY, "Unable to allocate %u bytes for String Table", _lBufSize + 1);
memset(_pBuf, 0, _lBufSize + 1);
@@ -110,6 +110,10 @@ ErrorCode CBofStringTable::buildTable() {
while (pBuf < _pBuf + _lBufSize) {
int nId = atoi((const char *)pBuf);
pBuf = (const byte *)strchr((const char *)pBuf, '=');
+ if (pBuf == nullptr) {
+ reportError(ERR_NONE, "Parsing error in buildTable()");
+ break;
+ }
pBuf++;
CResString *pString = new CResString(nId, (const char *)pBuf);
More information about the Scummvm-git-logs
mailing list