X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6c68b84a6e2dfc8657660c2d939ad3fd8ad096a8..8040711b9026716982b6909cc2c9abdbb930a583:/client/cmdlfpresco.c diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index d6a32448..51756c4f 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -45,6 +45,8 @@ int GetWiegandFromPresco(const char *Cmd, uint32_t *sitecode, uint32_t *usercode uint8_t cmdp = 0; char id[11]; int stringlen = 0; + memset(id, 0x00, sizeof(id)); + while(param_getchar(Cmd, cmdp) != 0x00) { switch(param_getchar(Cmd, cmdp)) { case 'h': @@ -81,19 +83,19 @@ int GetWiegandFromPresco(const char *Cmd, uint32_t *sitecode, uint32_t *usercode if(errors) return -1; if (!hex) { - for (int index =0; index < strlen(id); ++index) { - - // Get value from number string. - if ( id[index] == '*' ) val = 10; - if ( id[index] == '#') val = 11; - if ( id[index] >= 0x30 && id[index] <= 0x39 ) - val = id[index] - 0x30; - - *fullcode += val; + for (int index =0; index < strlen(id); ++index) { - // last digit is only added, not multipled. - if ( index < strlen(id)-1 ) - *fullcode *= 12; + // Get value from number string. + if ( id[index] == '*' ) val = 10; + if ( id[index] == '#') val = 11; + if ( id[index] >= 0x30 && id[index] <= 0x39 ) + val = id[index] - 0x30; + + *fullcode += val; + + // last digit is only added, not multipled. + if ( index < strlen(id)-1 ) + *fullcode *= 12; } }