int wordCnt = 0;
while(1){
- while(isspace(str[beginIndex])){
+ while(isspace((unsigned char)str[beginIndex])){
++beginIndex;
}
if(str[beginIndex] == '\0') {
break;
}
endIndex = beginIndex;
- while (str[endIndex] && !isspace(str[endIndex])){
+ while (str[endIndex] && !isspace((unsigned char)str[endIndex])){
++endIndex;
}
int len = endIndex - beginIndex;
return 1;
}
- if (isxdigit(c)) {
+ if (isxdigit((unsigned char)c)) {
// len = data + PCB(1b) + CRC(2b)
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data) - 1 - 2, &datalen)) {
case 1:
\r
if( buf[0]=='#' ) continue; //The line start with # is comment, skip\r
\r
- if (!isxdigit(buf[0])){\r
+ if (!isxdigit((unsigned char)buf[0])){\r
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);\r
continue;\r
}\r
//The line start with # is comment, skip\r
if( buf[0]=='#' ) continue;\r
\r
- if (!isxdigit(buf[0])) {\r
+ if (!isxdigit((unsigned char)buf[0])) {\r
PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);\r
continue;\r
}\r
{
DIR *dp;
struct dirent *ep;
- char script_directory_path[strlen(get_my_executable_directory()) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
- strcpy(script_directory_path, get_my_executable_directory());
+ char const * exedir = get_my_executable_directory();
+ if (exedir == NULL)
+ return 0;
+ char script_directory_path[strlen(exedir) + strlen(LUA_SCRIPTS_DIRECTORY) + 1];
+ strcpy(script_directory_path, exedir);
strcat(script_directory_path, LUA_SCRIPTS_DIRECTORY);
dp = opendir(script_directory_path);
// EMV commands
//-----------------------------------------------------------------------------
+#include <ctype.h>
#include "cmdemv.h"
#include "test/cryptotest.h"
return 1;
}
- if (isxdigit(c)) {
+ if (isxdigit((unsigned char)c)) {
switch(param_gethex_to_eol(cmd, cmdp, data, sizeof(data), &datalen)) {
case 1:
PrintAndLog("Invalid HEX value.");
sbyte = 0;
odd = 0;
}
- } else if (isspace(a[ii])) {
+ } else if (isspace((unsigned char)a[ii])) {
/* ignore */
} else {
/* err ... ignore too*/
uerror("cannot allocate memory for comparison string");
akey.name = uptr = ukey;
do
- *uptr++ = toupper(*key);
+ *uptr++ = toupper((unsigned char)*key);
while(*key++);
aptr = bsearch(&akey, aliases, NALIASES, sizeof(struct malias), (int (*)(const void *, const void *)) &acmp);
return 1;
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);
data[i / 2] = temp & 0xff;
return 1;
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);
data[i / 2] = temp & 0xff;
continue;
}
- if (isxdigit(line[indx])) {
+ if (isxdigit((unsigned char)line[indx])) {
buf[strlen(buf) + 1] = 0x00;
buf[strlen(buf)] = line[indx];
} else {
else if (x >= 'A' && x <= 'F')
x -= 'A' - 10;
else {
- printf("Discovered unknown character %c %d at idx %d of %s\n", x, x, (unsigned int)(source - start), start);
+ printf("Discovered unknown character %c %d at idx %tu of %s\n", x, x, source - start, start);
return 0;
}
// output