Skip to content

Commit

Permalink
use a safe way to copy the chip string
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkcz authored and pgwipeout committed Aug 30, 2021
1 parent 3df7303 commit df4656e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ static bool saveEntry(FILE* outFile, char* path, rk_entry_type type,
static inline uint32_t convertChipType(const char* chip) {
char buffer[5];
memset(buffer, 0, sizeof(buffer));
snprintf(buffer, sizeof(buffer), "%s", chip);
memccpy(buffer, chip, '\0', sizeof(buffer));
return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3];
}

Expand Down

0 comments on commit df4656e

Please sign in to comment.