mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
Fix warnings and missing #include for <ctype.h>
This commit is contained in:
parent
feb1bf4184
commit
e0b2de0cce
8 changed files with 13 additions and 11 deletions
|
@ -40,14 +40,14 @@ int split(char *str, char *arr[MAX_ARGS]){
|
||||||
int wordCnt = 0;
|
int wordCnt = 0;
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
while(isspace(str[beginIndex])){
|
while(isspace((unsigned char)str[beginIndex])){
|
||||||
++beginIndex;
|
++beginIndex;
|
||||||
}
|
}
|
||||||
if(str[beginIndex] == '\0') {
|
if(str[beginIndex] == '\0') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
endIndex = beginIndex;
|
endIndex = beginIndex;
|
||||||
while (str[endIndex] && !isspace(str[endIndex])){
|
while (str[endIndex] && !isspace((unsigned char)str[endIndex])){
|
||||||
++endIndex;
|
++endIndex;
|
||||||
}
|
}
|
||||||
int len = endIndex - beginIndex;
|
int len = endIndex - beginIndex;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "util_posix.h"
|
#include "util_posix.h"
|
||||||
#include "iso14443crc.h"
|
#include "iso14443crc.h"
|
||||||
|
@ -764,7 +765,7 @@ int CmdHF14AAPDU(const char *cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxdigit(c)) {
|
if (isxdigit((unsigned char)c)) {
|
||||||
// len = data + PCB(1b) + CRC(2b)
|
// len = data + PCB(1b) + CRC(2b)
|
||||||
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data) - 1 - 2, &datalen)) {
|
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data) - 1 - 2, &datalen)) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
|
|
||||||
if( buf[0]=='#' ) continue; //The line start with # is comment, skip
|
if( buf[0]=='#' ) continue; //The line start with # is comment, skip
|
||||||
|
|
||||||
if (!isxdigit(buf[0])){
|
if (!isxdigit((unsigned char)buf[0])){
|
||||||
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);
|
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1433,7 +1433,7 @@ int CmdT55xxBruteForce(const char *Cmd) {
|
||||||
//The line start with # is comment, skip
|
//The line start with # is comment, skip
|
||||||
if( buf[0]=='#' ) continue;
|
if( buf[0]=='#' ) continue;
|
||||||
|
|
||||||
if (!isxdigit(buf[0])) {
|
if (!isxdigit((unsigned char)buf[0])) {
|
||||||
PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);
|
PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// EMV commands
|
// EMV commands
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include "cmdemv.h"
|
#include "cmdemv.h"
|
||||||
|
|
||||||
int UsageCmdHFEMVSelect(void) {
|
int UsageCmdHFEMVSelect(void) {
|
||||||
|
@ -68,7 +69,7 @@ int CmdHFEMVSelect(const char *cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxdigit(c)) {
|
if (isxdigit((unsigned char)c)) {
|
||||||
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data), &datalen)) {
|
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data), &datalen)) {
|
||||||
case 1:
|
case 1:
|
||||||
PrintAndLog("Invalid HEX value.");
|
PrintAndLog("Invalid HEX value.");
|
||||||
|
|
|
@ -306,7 +306,7 @@ static int l_pack(lua_State *L) /** pack(f,...) */
|
||||||
sbyte = 0;
|
sbyte = 0;
|
||||||
odd = 0;
|
odd = 0;
|
||||||
}
|
}
|
||||||
} else if (isspace(a[ii])) {
|
} else if (isspace((unsigned char)a[ii])) {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
} else {
|
} else {
|
||||||
/* err ... ignore too*/
|
/* err ... ignore too*/
|
||||||
|
|
|
@ -596,7 +596,7 @@ mbynam(model_t *dest, const char *key) {
|
||||||
uerror("cannot allocate memory for comparison string");
|
uerror("cannot allocate memory for comparison string");
|
||||||
akey.name = uptr = ukey;
|
akey.name = uptr = ukey;
|
||||||
do
|
do
|
||||||
*uptr++ = toupper(*key);
|
*uptr++ = toupper((unsigned char)*key);
|
||||||
while(*key++);
|
while(*key++);
|
||||||
|
|
||||||
aptr = bsearch(&akey, aliases, NALIASES, sizeof(struct malias), (int (*)(const void *, const void *)) &acmp);
|
aptr = bsearch(&akey, aliases, NALIASES, sizeof(struct malias), (int (*)(const void *, const void *)) &acmp);
|
||||||
|
|
|
@ -496,7 +496,7 @@ int param_gethex(const char *line, int paramnum, uint8_t * data, int hexcnt)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for(i = 0; i < hexcnt; i += 2) {
|
for(i = 0; i < hexcnt; i += 2) {
|
||||||
if (!(isxdigit(line[bg + i]) && isxdigit(line[bg + i + 1])) ) return 1;
|
if (!(isxdigit((unsigned char)line[bg + i]) && isxdigit((unsigned char)line[bg + i + 1])) ) return 1;
|
||||||
|
|
||||||
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
||||||
data[i / 2] = temp & 0xff;
|
data[i / 2] = temp & 0xff;
|
||||||
|
@ -518,7 +518,7 @@ int param_gethex_ex(const char *line, int paramnum, uint8_t * data, int *hexcnt)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for(i = 0; i < *hexcnt; i += 2) {
|
for(i = 0; i < *hexcnt; i += 2) {
|
||||||
if (!(isxdigit(line[bg + i]) && isxdigit(line[bg + i + 1])) ) return 1;
|
if (!(isxdigit((unsigned char)line[bg + i]) && isxdigit((unsigned char)line[bg + i + 1])) ) return 1;
|
||||||
|
|
||||||
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
sscanf((char[]){line[bg + i], line[bg + i + 1], 0}, "%X", &temp);
|
||||||
data[i / 2] = temp & 0xff;
|
data[i / 2] = temp & 0xff;
|
||||||
|
@ -543,7 +543,7 @@ int param_gethex_to_eol(const char *line, int paramnum, uint8_t * data, int maxd
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isxdigit(line[indx])) {
|
if (isxdigit((unsigned char)line[indx])) {
|
||||||
buf[strlen(buf) + 1] = 0x00;
|
buf[strlen(buf) + 1] = 0x00;
|
||||||
buf[strlen(buf)] = line[indx];
|
buf[strlen(buf)] = line[indx];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue