Skip to content

Commit

Permalink
Fix potential buffer overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikMinekus committed Jan 4, 2021
1 parent cec90d1 commit 75c1c13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/advertisements.sp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void ProcessVariables(const char[] message, char[] buffer, int maxlength)
int buf_idx, i, name_len;
ConVar hConVar;

while (message[i]) {
while (message[i] && buf_idx < maxlength - 1) {
if (message[i] != '{' || (name_len = FindCharInString(message[i + 1], '}')) == -1) {
buffer[buf_idx++] = message[i++];
continue;
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/advertisements/chatcolors.sp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void ProcessChatColors(const char[] message, char[] buffer, int maxlength)
int buf_idx = PreFormat(buffer, maxlength);
int i, name_len;

while (message[i]) {
while (message[i] && buf_idx < maxlength - 1) {
if (message[i] != '{' || (name_len = FindCharInString(message[i + 1], '}')) == -1) {
buffer[buf_idx++] = message[i++];
continue;
Expand Down

0 comments on commit 75c1c13

Please sign in to comment.