Fix possible buffer overflow

parent d3727b3e
Pipeline #104 skipped
...@@ -200,7 +200,7 @@ bool CardReader::selectFile(const char* filename, bool silent/*=false*/) { ...@@ -200,7 +200,7 @@ bool CardReader::selectFile(const char* filename, bool silent/*=false*/) {
ECHO_EMV(SERIAL_SD_SIZE, file.fileSize()); ECHO_EMV(SERIAL_SD_SIZE, file.fileSize());
} }
for (int c = 0; c <= sizeof(fullName); c++) for (int c = 0; c < sizeof(fullName); c++)
const_cast<char&>(fullName[c]) = '\0'; const_cast<char&>(fullName[c]) = '\0';
strncpy(fullName, filename, strlen(filename)); strncpy(fullName, filename, strlen(filename));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment