Stop possibly writing past the end of msg_buf
This commit is contained in:
parent
3286267db9
commit
3a0a3c6aa0
1 changed files with 2 additions and 1 deletions
|
@ -52,7 +52,6 @@ void channel_from_cobol(char *cobol_buffer)
|
|||
break;
|
||||
}
|
||||
}
|
||||
msg_buf[i] = '\0';
|
||||
if (i == BUFFER_SIZE) {
|
||||
int message_length = 0;
|
||||
for(i = 0; i < BUFFER_SIZE; i++) {
|
||||
|
@ -64,6 +63,8 @@ void channel_from_cobol(char *cobol_buffer)
|
|||
message_length--;
|
||||
}
|
||||
msg_buf[message_length] = '\0';
|
||||
} else {
|
||||
msg_buf[i] = '\0';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue