mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] ToolBoxHelpers: don't overflow buffer
If the commandLength is > than the buffer size, we have to escape at some point to avoid overflowing the buffer.
This commit is contained in:
committed by
LeaNumworks
parent
3e6e1729a2
commit
b4a3dd10e1
@@ -41,7 +41,7 @@ void TextToInsertForCommandText(const char * command, int commandLength, char *
|
||||
|
||||
UTF8Decoder decoder(command);
|
||||
CodePoint codePoint = decoder.nextCodePoint();
|
||||
while (codePoint != UCodePointNull && (commandLength < 0 || (decoder.stringPosition() - command <= commandLength))) {
|
||||
while (codePoint != UCodePointNull && index < bufferSize - 1 && (commandLength < 0 || (decoder.stringPosition() - command <= commandLength))) {
|
||||
if (codePoint == ')') {
|
||||
numberOfOpenParentheses--;
|
||||
} else if (codePoint == ']') {
|
||||
|
||||
Reference in New Issue
Block a user