X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/815544537ca4ea7c13c9f9384284a6dea9ac818d..bb84c38196e5d16fc8105a6d9c7340cd11b72692:/client/cmdlft55xx.c?ds=sidebyside diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 7d967d5d..a75d2fd3 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -308,7 +308,7 @@ bool DecodeT55xxBlock(){ break; case DEMOD_BI: case DEMOD_BIa: - sprintf(cmdStr,"0 %d %d 1", bitRate[config.bitrate], config.inverted ); + sprintf(cmdStr,"0 %d %d 0", bitRate[config.bitrate], config.inverted ); ans = ASKbiphaseDemod(cmdStr, FALSE); break; default: @@ -737,7 +737,7 @@ int CmdT55xxReadTrace(const char *Cmd) uint32_t icr = PackBits(si, 3, DemodBuffer); si += 3; uint32_t year = PackBits(si, 4, DemodBuffer); si += 4; uint32_t quarter = PackBits(si, 2, DemodBuffer); si += 2; - uint32_t lotid = PackBits(si, 14, DemodBuffer); si += 14; + uint32_t lotid = PackBits(si, 14, DemodBuffer); si += 14; uint32_t wafer = PackBits(si, 5, DemodBuffer); si += 5; uint32_t dw = PackBits(si, 15, DemodBuffer); @@ -761,7 +761,7 @@ int CmdT55xxReadTrace(const char *Cmd) PrintAndLog(" CID : 0x%02X (%d) - %s", cid, cid, GetModelStrFromCID(cid)); PrintAndLog(" ICR IC Revision : %d",icr ); PrintAndLog(" Manufactured"); - PrintAndLog(" Year/Quarter : %d/%d",year, quarter ); + PrintAndLog(" Year/Quarter : 20?%d/%d",year, quarter); PrintAndLog(" Lot ID : %d", lotid ); PrintAndLog(" Wafer number : %d", wafer); PrintAndLog(" Die Number : %d", dw); @@ -923,31 +923,31 @@ char * GetBitRateStr(uint32_t id){ char *retStr = buf; switch (id){ case 0: - sprintf(retStr,"%d - RF/8",id); + snprintf(retStr,sizeof(buf),"%d - RF/8",id); break; case 1: - sprintf(retStr,"%d - RF/16",id); + snprintf(retStr,sizeof(buf),"%d - RF/16",id); break; case 2: - sprintf(retStr,"%d - RF/32",id); + snprintf(retStr,sizeof(buf),"%d - RF/32",id); break; case 3: - sprintf(retStr,"%d - RF/40",id); + snprintf(retStr,sizeof(buf),"%d - RF/40",id); break; case 4: - sprintf(retStr,"%d - RF/50",id); + snprintf(retStr,sizeof(buf),"%d - RF/50",id); break; case 5: - sprintf(retStr,"%d - RF/64",id); + snprintf(retStr,sizeof(buf),"%d - RF/64",id); break; case 6: - sprintf(retStr,"%d - RF/100",id); + snprintf(retStr,sizeof(buf),"%d - RF/100",id); break; case 7: - sprintf(retStr,"%d - RF/128",id); + snprintf(retStr,sizeof(buf),"%d - RF/128",id); break; default: - sprintf(retStr,"%d - (Unknown)",id); + snprintf(retStr,sizeof(buf),"%d - (Unknown)",id); break; } @@ -958,59 +958,60 @@ char * GetSaferStr(uint32_t id){ static char buf[20]; char *retStr = buf; - sprintf(retStr,"%d",id); + snprintf(retStr,sizeof(buf),"%d",id); if (id == 6) { - sprintf(retStr,"%d - passwd",id); + snprintf(retStr,sizeof(buf),"%d - passwd",id); } if (id == 9 ){ - sprintf(retStr,"%d - testmode",id); + snprintf(retStr,sizeof(buf),"%d - testmode",id); } return buf; } + char * GetModulationStr( uint32_t id){ static char buf[60]; char *retStr = buf; switch (id){ case 0: - sprintf(retStr,"%d - DIRECT (ASK/NRZ)",id); + snprintf(retStr,sizeof(buf),"%d - DIRECT (ASK/NRZ)",id); break; case 1: - sprintf(retStr,"%d - PSK 1 phase change when input changes",id); + snprintf(retStr,sizeof(buf),"%d - PSK 1 phase change when input changes",id); break; case 2: - sprintf(retStr,"%d - PSK 2 phase change on bitclk if input high",id); + snprintf(retStr,sizeof(buf),"%d - PSK 2 phase change on bitclk if input high",id); break; case 3: - sprintf(retStr,"%d - PSK 3 phase change on rising edge of input",id); + snprintf(retStr,sizeof(buf),"%d - PSK 3 phase change on rising edge of input",id); break; case 4: - sprintf(retStr,"%d - FSK 1 RF/8 RF/5",id); + snprintf(retStr,sizeof(buf),"%d - FSK 1 RF/8 RF/5",id); break; case 5: - sprintf(retStr,"%d - FSK 2 RF/8 RF/10",id); + snprintf(retStr,sizeof(buf),"%d - FSK 2 RF/8 RF/10",id); break; case 6: - sprintf(retStr,"%d - FSK 1a RF/5 RF/8",id); + snprintf(retStr,sizeof(buf),"%d - FSK 1a RF/5 RF/8",id); break; case 7: - sprintf(retStr,"%d - FSK 2a RF/10 RF/8",id); + snprintf(retStr,sizeof(buf),"%d - FSK 2a RF/10 RF/8",id); break; case 8: - sprintf(retStr,"%d - Manschester",id); + snprintf(retStr,sizeof(buf),"%d - Manschester",id); break; case 16: - sprintf(retStr,"%d - Biphase",id); + snprintf(retStr,sizeof(buf),"%d - Biphase",id); break; case 0x18: - sprintf(retStr,"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id); + snprintf(retStr,sizeof(buf),"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id); break; case 17: - sprintf(retStr,"%d - Reserved",id); + snprintf(retStr,sizeof(buf),"%d - Reserved",id); break; default: - sprintf(retStr,"0x%02X (Unknown)",id); + snprintf(retStr,sizeof(buf),"0x%02X (Unknown)",id); break; } return buf; @@ -1021,55 +1022,55 @@ char * GetModelStrFromCID(uint32_t cid){ static char buf[10]; char *retStr = buf; - if (cid == 1) sprintf(retStr,"ATA5577M1"); - if (cid == 2) sprintf(retStr,"ATA5577M2"); + if (cid == 1) snprintf(retStr, sizeof(buf),"ATA5577M1"); + if (cid == 2) snprintf(retStr, sizeof(buf),"ATA5577M2"); return buf; } char * GetSelectedModulationStr( uint8_t id){ - static char buf[16]; + static char buf[20]; char *retStr = buf; switch (id){ case DEMOD_FSK: - sprintf(retStr,"FSK"); + snprintf(retStr,sizeof(buf),"FSK"); break; case DEMOD_FSK1: - sprintf(retStr,"FSK1"); + snprintf(retStr,sizeof(buf),"FSK1"); break; case DEMOD_FSK1a: - sprintf(retStr,"FSK1a"); + snprintf(retStr,sizeof(buf),"FSK1a"); break; case DEMOD_FSK2: - sprintf(retStr,"FSK2"); + snprintf(retStr,sizeof(buf),"FSK2"); break; case DEMOD_FSK2a: - sprintf(retStr,"FSK2a"); + snprintf(retStr,sizeof(buf),"FSK2a"); break; case DEMOD_ASK: - sprintf(retStr,"ASK"); + snprintf(retStr,sizeof(buf),"ASK"); break; case DEMOD_NRZ: - sprintf(retStr,"DIRECT/NRZ"); + snprintf(retStr,sizeof(buf),"DIRECT/NRZ"); break; case DEMOD_PSK1: - sprintf(retStr,"PSK1"); + snprintf(retStr,sizeof(buf),"PSK1"); break; case DEMOD_PSK2: - sprintf(retStr,"PSK2"); + snprintf(retStr,sizeof(buf),"PSK2"); break; case DEMOD_PSK3: - sprintf(retStr,"PSK3"); + snprintf(retStr,sizeof(buf),"PSK3"); break; case DEMOD_BI: - sprintf(retStr,"BIPHASE"); + snprintf(retStr,sizeof(buf),"BIPHASE"); break; case DEMOD_BIa: - sprintf(retStr,"BIPHASEa - (CDP)"); + snprintf(retStr,sizeof(buf),"BIPHASEa - (CDP)"); break; default: - sprintf(retStr,"(Unknown)"); + snprintf(retStr,sizeof(buf),"(Unknown)"); break; } return buf;