Skip to content

Commit

Permalink
Never pass null pointer in vsnprintf, since our size available is nev…
Browse files Browse the repository at this point in the history
…er 0
  • Loading branch information
andreilitvin committed Jun 30, 2023
1 parent 2077d6b commit 3685791
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/support/StringBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ StringBuilderBase & StringBuilderBase::AddFormat(const char * format, ...)
if (mWriter.Available() > 0)
{
output = reinterpret_cast<char *>(mWriter.Buffer() + mWriter.Needed());
} else {
output = reinterpret_cast<char *>(mWriter.Buffer() + mWriter.Size());
}

// the + 1 size here because StringBuilder reserves one byte for final null terminator
Expand Down

0 comments on commit 3685791

Please sign in to comment.