diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-09 09:19:51 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-09 09:19:51 +0200 |
commit | 82ac6c87ce0b0af2fb8de25d70442fec406bb742 (patch) | |
tree | 74bbca60b73160c432cd497563bf8f8de1ce80ea /src/plugins/serial/serial_terminal.c | |
parent | 342ebce798fe98ede64939a49bbc3770d8214649 (diff) |
New upstream version 1.8.18upstream/1.8.18
Diffstat (limited to 'src/plugins/serial/serial_terminal.c')
-rw-r--r-- | src/plugins/serial/serial_terminal.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/serial/serial_terminal.c b/src/plugins/serial/serial_terminal.c index cd33422..4459f64 100644 --- a/src/plugins/serial/serial_terminal.c +++ b/src/plugins/serial/serial_terminal.c @@ -33,7 +33,9 @@ /* Serial Interface, Terminal Mode plugin. */ +#if defined HAVE_ALLOCA_H #include <alloca.h> +#endif #include <stdio.h> #include <fcntl.h> #include <unistd.h> @@ -77,7 +79,7 @@ struct ipmb_msg_hdr { unsigned char rqSA; unsigned char rqSeq; /* RQ SEQ | RQ LUN */ unsigned char cmd; - unsigned char data[0]; + unsigned char data[]; }; /* @@ -99,7 +101,7 @@ struct ipmi_get_message_rp { unsigned char rsSA; unsigned char rqSeq; unsigned char cmd; - unsigned char data[0]; + unsigned char data[]; }; /* @@ -371,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; } } |