From d393b6c60b9e25b02ca4fea7aea87d59bf80c568 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 28 Jul 2018 14:39:21 +0200 Subject: [PATCH] fix: 'hw version' buffer overflow --- client/cmdhw.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/cmdhw.c b/client/cmdhw.c index 82b4549e2..66f343a3c 100644 --- a/client/cmdhw.c +++ b/client/cmdhw.c @@ -252,20 +252,16 @@ int CmdVersion(const char *Cmd) { #else PrintAndLogEx(NORMAL, "\n\e[34mProxmark3 RFID instrument\e[0m\n"); #endif - char s[40] = {0}; - int i = 0; + char s[50] = {0}; #if defined(WITH_FLASH) || defined(WITH_SMARTCARD) - strncat(s, "build for RDV40 with ", 22); - i = 15; + strncat(s, "build for RDV40 with ", sizeof(s) - strlen(s) - 1); #endif #ifdef WITH_FLASH - strncat(s, "flashmem; ", 10); - i += 10; + strncat(s, "flashmem; ", sizeof(s) - strlen(s) - 1); #endif #ifdef WITH_SMARTCARD - strncat(s+i, "smartcard; ", 11); - i += 11; + strncat(s, "smartcard; ", sizeof(s) - strlen(s) - 1); #endif PrintAndLogEx(NORMAL, "\n [ CLIENT ]"); PrintAndLogEx(NORMAL, " client: iceman %s \n", s);