mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07: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.
|
// 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
|
#if DEBUG
|
||||||
struct {
|
struct {
|
||||||
uint16_t flag;
|
uint16_t flag;
|
||||||
uint8_t buf[PM3_CMD_DATA_SIZE - sizeof(uint16_t)];
|
uint8_t buf[PM3_CMD_DATA_SIZE - sizeof(uint16_t)];
|
||||||
} PACKED data;
|
} PACKED data;
|
||||||
data.flag = flags;
|
data.flag = flags;
|
||||||
uint16_t len = MIN(strlen(str), sizeof(data.buf));
|
uint16_t len = MIN(srclen, sizeof(data.buf));
|
||||||
memcpy(data.buf, str, len);
|
memcpy(data.buf, src, len);
|
||||||
reply_ng(CMD_DEBUG_PRINT_STRING, PM3_SUCCESS, (uint8_t *)&data, sizeof(data.flag) + len);
|
reply_ng(CMD_DEBUG_PRINT_STRING, PM3_SUCCESS, (uint8_t *)&data, sizeof(data.flag) + len);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbpString(char *str) {
|
void DbpString(char *str) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DbpStringEx(FLAG_LOG, str);
|
DbpStringEx(FLAG_LOG, str, strlen(str));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbprintfEx(uint32_t flags, const char *fmt, ...) {
|
void DbprintfEx(uint32_t flags, const char *fmt, ...) {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// should probably limit size here; oh well, let's just use a big buffer
|
// 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_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
kvsprintf(fmt, output_string, 10, ap);
|
kvsprintf(fmt, s, 10, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
DbpStringEx(flags, output_string);
|
DbpStringEx(flags, s, strlen(s));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
|
|
||||||
void DbpString(char *str);
|
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 Dbprintf(const char *fmt, ...);
|
||||||
void DbprintfEx(uint32_t flags, const char *fmt, ...);
|
void DbprintfEx(uint32_t flags, const char *fmt, ...);
|
||||||
void Dbhexdump(int len, uint8_t *d, bool bAsci);
|
void Dbhexdump(int len, uint8_t *d, bool bAsci);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue