\r
len = param_getstr(Cmd,nameParamNo,filename);\r
\r
- if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
+ if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE - 4;\r
\r
- fnameptr += len-4;\r
+ fnameptr += len;\r
\r
sprintf(fnameptr, ".eml"); \r
\r
\r
len = param_getstr(Cmd,nameParamNo,filename);\r
\r
- if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
+ if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE - 4;\r
\r
// user supplied filename?\r
if (len < 1) {\r
// get filename (UID from memory)\r
if (mfEmlGetMem(buf, 0, 1)) {\r
PrintAndLog("Can\'t get UID from block: %d", 0);\r
- sprintf(filename, "dump.eml"); \r
+ len = sprintf(fnameptr, "dump"); \r
+ fnameptr += len;\r
+ }\r
+ else {\r
+ for (j = 0; j < 7; j++, fnameptr += 2)\r
+ sprintf(fnameptr, "%02X", buf[j]); \r
}\r
- for (j = 0; j < 7; j++, fnameptr += 2)\r
- sprintf(fnameptr, "%02X", buf[j]); \r
} else {\r
- fnameptr += len-4;\r
+ fnameptr += len;\r
}\r
\r
// add file extension\r
return 0;\r
} else {\r
len = strlen(Cmd);\r
- if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
+ if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE - 4;\r
\r
memcpy(filename, Cmd, len);\r
- fnameptr += len-4;\r
+ fnameptr += len;\r
\r
sprintf(fnameptr, ".eml"); \r
\r
return 0;\r
} else {\r
len = strlen(Cmd);\r
- if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
+ if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE - 4;\r
\r
if (len < 1) {\r
// get filename\r
if (mfCGetBlock(0, buf, CSETBLOCK_SINGLE_OPER)) {\r
PrintAndLog("Cant get block: %d", 0);\r
- return 1;\r
+ len = sprintf(fnameptr, "dump");\r
+ fnameptr += len;\r
+ } else {\r
+ for (j = 0; j < 7; j++, fnameptr += 2)\r
+ sprintf(fnameptr, "%02x", buf[j]); \r
}\r
- for (j = 0; j < 7; j++, fnameptr += 2)\r
- sprintf(fnameptr, "%02x", buf[j]); \r
} else {\r
memcpy(filename, Cmd, len);\r
fnameptr += len;\r