COVERITY 12: prevent overrun of logsys output buffers.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2547 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Angus Salkeld 2009-11-22 23:19:41 +00:00
parent 28f7c1e51f
commit 34ddb1cb14

View File

@ -527,8 +527,12 @@ static void log_printf_to_logs (
syslog_output_buffer_idx += syslog_len;
format_buffer_idx += 1;
}
if ((normal_output_buffer_idx == sizeof (normal_output_buffer)) ||
(syslog_output_buffer_idx == sizeof (syslog_output_buffer))) {
if ((normal_output_buffer_idx >= sizeof (normal_output_buffer) - 2) ||
(syslog_output_buffer_idx >= sizeof (syslog_output_buffer) - 1)) {
/* Note: we make allowance for '\0' at the end of
* both of these arrays and normal_output_buffer also
* needs a '\n'.
*/
break;
}
}