diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-09 09:19:55 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-10-09 09:19:55 +0200 |
commit | 7ddeb3781f3d79ef1ae5a765a66f6cdd1ec113ef (patch) | |
tree | 3546836f27de4168559a62d8022626dfb101a133 /src/plugins/serial/serial_terminal.c | |
parent | 5bac665e38a15e6725f9ec17c7f7e80a0506aa08 (diff) | |
parent | 82ac6c87ce0b0af2fb8de25d70442fec406bb742 (diff) |
Merge tag 'upstream/1.8.18'
Upstream version 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; } } |