# Fixed a compiler warning and a possible buffer overflow in cCiMMI::SendAnswer(). # --- ci.c 2019/05/05 14:15:56 5.3 +++ ci.c 2019/05/06 11:47:42 @@ -1591,9 +1591,12 @@ 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; }