提交 373f9f3c 编写于 作者: L Longda

Fix failed to bin to hex wrong format data

上级 925711cd
...@@ -194,7 +194,7 @@ char *bin_to_hex(const char *s, const int len, char *hex_buff) ...@@ -194,7 +194,7 @@ char *bin_to_hex(const char *s, const int len, char *hex_buff)
int new_len = 0; int new_len = 0;
unsigned char *end = (unsigned char *)s + len; unsigned char *end = (unsigned char *)s + len;
for (unsigned char *p = (unsigned char *)s; p < end; p++) { for (unsigned char *p = (unsigned char *)s; p < end; p++) {
new_len += snprintf(hex_buff + new_len, 2, "%02x", *p); new_len += snprintf(hex_buff + new_len, 3, "%02x", *p);
} }
hex_buff[new_len] = '\0'; hex_buff[new_len] = '\0';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部