fix: 'hw version' buffer overflow

This commit is contained in:
iceman1001 2018-07-28 14:39:21 +02:00
parent 4172ea6c19
commit d393b6c60b

View file

@ -252,20 +252,16 @@ int CmdVersion(const char *Cmd) {
#else #else
PrintAndLogEx(NORMAL, "\n\e[34mProxmark3 RFID instrument\e[0m\n"); PrintAndLogEx(NORMAL, "\n\e[34mProxmark3 RFID instrument\e[0m\n");
#endif #endif
char s[40] = {0}; char s[50] = {0};
int i = 0;
#if defined(WITH_FLASH) || defined(WITH_SMARTCARD) #if defined(WITH_FLASH) || defined(WITH_SMARTCARD)
strncat(s, "build for RDV40 with ", 22); strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1);
i = 15;
#endif #endif
#ifdef WITH_FLASH #ifdef WITH_FLASH
strncat(s, "flashmem; ", 10); strncat(s, "flashmem; ", sizeof(s) - strlen(s) - 1);
i += 10;
#endif #endif
#ifdef WITH_SMARTCARD #ifdef WITH_SMARTCARD
strncat(s+i, "smartcard; ", 11); strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1);
i += 11;
#endif #endif
PrintAndLogEx(NORMAL, "\n [ CLIENT ]"); PrintAndLogEx(NORMAL, "\n [ CLIENT ]");
PrintAndLogEx(NORMAL, " client: iceman %s \n", s); PrintAndLogEx(NORMAL, " client: iceman %s \n", s);