ID:447 - Fix access beyond array limits in serial_terminal

This commit is contained in:
Dmitry Rakhchev 2016-06-08 11:21:52 +03:00 committed by Zdenek Styblik
parent d56220f81f
commit a203644728

View File

@ -373,8 +373,9 @@ recv_response(struct ipmi_intf * intf, unsigned char *data, int len)
}
p += rv;
resp_len += rv;
if (*(p - 2) == ']' && (*(p - 1) == '\n' || *(p - 1) == '\r')) {
*p = 0;
if (resp_len >= 2 && *(p - 2) == ']'
&& (*(p - 1) == '\n' || *(p - 1) == '\r')) {
*(p - 1) = 0; /* overwrite EOL */
break;
}
}