mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-12 18:25:07 +08:00
coverity 226262
This commit is contained in:
parent
371a0e3ee0
commit
7435663ea1
2 changed files with 8 additions and 8 deletions
|
@ -22,35 +22,35 @@
|
|||
// Debug print functions, to go out over USB, to the usual PC-side client.
|
||||
//=============================================================================
|
||||
|
||||
void DbpStringEx(uint32_t flags, char *str) {
|
||||
void DbpStringEx(uint32_t flags, char *src, size_t srclen) {
|
||||
#if DEBUG
|
||||
struct {
|
||||
uint16_t flag;
|
||||
uint8_t buf[PM3_CMD_DATA_SIZE - sizeof(uint16_t)];
|
||||
} PACKED data;
|
||||
data.flag = flags;
|
||||
uint16_t len = MIN(strlen(str), sizeof(data.buf));
|
||||
memcpy(data.buf, str, len);
|
||||
uint16_t len = MIN(srclen, sizeof(data.buf));
|
||||
memcpy(data.buf, src, len);
|
||||
reply_ng(CMD_DEBUG_PRINT_STRING, PM3_SUCCESS, (uint8_t *)&data, sizeof(data.flag) + len);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DbpString(char *str) {
|
||||
#if DEBUG
|
||||
DbpStringEx(FLAG_LOG, str);
|
||||
DbpStringEx(FLAG_LOG, str, strlen(str));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DbprintfEx(uint32_t flags, const char *fmt, ...) {
|
||||
#if DEBUG
|
||||
// should probably limit size here; oh well, let's just use a big buffer
|
||||
char output_string[PM3_CMD_DATA_SIZE] = {0x00};
|
||||
char s[PM3_CMD_DATA_SIZE] = {0x00};
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
kvsprintf(fmt, output_string, 10, ap);
|
||||
kvsprintf(fmt, s, 10, ap);
|
||||
va_end(ap);
|
||||
|
||||
DbpStringEx(flags, output_string);
|
||||
DbpStringEx(flags, s, strlen(s));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
|
||||
void DbpString(char *str);
|
||||
void DbpStringEx(uint32_t flags, char *str);
|
||||
void DbpStringEx(uint32_t flags, char *src, size_t srclen);
|
||||
void Dbprintf(const char *fmt, ...);
|
||||
void DbprintfEx(uint32_t flags, const char *fmt, ...);
|
||||
void Dbhexdump(int len, uint8_t *d, bool bAsci);
|
||||
|
|
Loading…
Reference in a new issue