This commit is contained in:
iceman1001 2019-04-25 17:06:40 +02:00
commit df96b58fcc
3 changed files with 11 additions and 6 deletions

View file

@ -123,7 +123,7 @@ void DbpStringEx(char *str, uint32_t cmd) {
data.flag = cmd; data.flag = cmd;
uint16_t len = MIN(strlen(str), sizeof(data.buf)); uint16_t len = MIN(strlen(str), sizeof(data.buf));
memcpy(data.buf, str, len); memcpy(data.buf, str, 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
} }

View file

@ -261,7 +261,7 @@ static void PacketResponseReceived(PacketResponseNG *packet) {
uint16_t flag; uint16_t flag;
uint8_t buf[USB_CMD_DATA_SIZE - sizeof(uint16_t)]; uint8_t buf[USB_CMD_DATA_SIZE - sizeof(uint16_t)];
} PACKED; } PACKED;
struct d* data = (struct d*)&packet->data.asBytes; struct d *data = (struct d *)&packet->data.asBytes;
len = packet->length - sizeof(data->flag); len = packet->length - sizeof(data->flag);
memcpy(s, data->buf, len); memcpy(s, data->buf, len);
flag = data->flag; flag = data->flag;
@ -617,7 +617,7 @@ bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms
response = &resp; response = &resp;
// Add delay depending on the communication channel & speed // Add delay depending on the communication channel & speed
if (ms_timeout != (size_t)-1) if (ms_timeout != (size_t) -1)
ms_timeout += communication_delay(); ms_timeout += communication_delay();
timeout_start_time = msclock(); timeout_start_time = msclock();
@ -707,7 +707,7 @@ static bool dl_it(uint8_t *dest, uint32_t bytes, uint32_t start_index, PacketRes
timeout_start_time = msclock(); timeout_start_time = msclock();
// Add delay depending on the communication channel & speed // Add delay depending on the communication channel & speed
if (ms_timeout != (size_t)-1) if (ms_timeout != (size_t) -1)
ms_timeout += communication_delay(); ms_timeout += communication_delay();
while (true) { while (true) {

View file

@ -480,9 +480,14 @@ static int unpack_object(scanner_t *s, json_t *root, va_list *ap) {
return -1; return -1;
} }
if (root && !json_is_object(root)) { if (root && !json_is_object(root)) {
set_error(s, "<validation>", json_error_wrong_type, "Expected object, got %s", set_error(s,
type_name(root)); "<validation>",
json_error_wrong_type,
"Expected object, got %s",
(root) ? type_name(root) : "NULL"
);
goto out; goto out;
} }
next_token(s); next_token(s);