1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a compiler warning and a possible buffer overflow in cCiMMI::SendAnswer()

This commit is contained in:
Klaus Schmidinger 2019-05-06 12:03:59 +02:00
parent 820c22775c
commit 294452cd43
2 changed files with 8 additions and 4 deletions

View File

@ -9398,3 +9398,4 @@ Video Disk Recorder Revision History
- Fixed updating the checksum in the CA table after mapping EMM PIDs for MTD (thanks to
Helmut Binder).
- Fixed a compiler warning in ExchangeChars() (thanks to Helmut Binder).
- Fixed a compiler warning and a possible buffer overflow in cCiMMI::SendAnswer().

11
ci.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: ci.c 4.24 2019/05/05 14:15:56 kls Exp $
* $Id: ci.c 4.25 2019/05/06 11:47:42 kls Exp $
*/
#include "ci.h"
@ -1591,9 +1591,12 @@ bool cCiMMI::SendAnswer(const char *Text)
struct tAnswer { uint8_t id; char text[256]; };//XXX
tAnswer answer;
answer.id = Text ? AI_ANSWER : AI_CANCEL;
if (Text)
strncpy(answer.text, Text, sizeof(answer.text));
SendData(AOT_ANSW, Text ? strlen(Text) + 1 : 1, (uint8_t *)&answer);
int len = 0;
if (Text) {
len = min(sizeof(answer.text), strlen(Text));
memcpy(answer.text, Text, len);
}
SendData(AOT_ANSW, len + 1, (uint8_t *)&answer);
return true;
}