From 1b6164be07917fcbef5cba7d9f6bf759569aa27b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 3 Apr 2020 08:35:32 +0200 Subject: [PATCH] change, sprint_hex no long has an extra space in the end. This will break some output designs :smile: --- client/ui.c | 5 +++-- client/util.c | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/ui.c b/client/ui.c index bac8b2956..5097b28f1 100644 --- a/client/ui.c +++ b/client/ui.c @@ -80,10 +80,11 @@ int searchHomeFilePath(char **foundpath, const char *filename, bool create_home) if ((result != 0) && create_home) { #ifdef _WIN32 - if (_mkdir(path)) { + if (_mkdir(path)) #else - if (mkdir(path, 0700)) { + if (mkdir(path, 0700)) #endif + { fprintf(stderr, "Could not create user directory %s\n", path); free(path); return PM3_EFILE; diff --git a/client/util.c b/client/util.c index 226255536..36362f83b 100644 --- a/client/util.c +++ b/client/util.c @@ -211,6 +211,9 @@ void hex_to_buffer(const uint8_t *buf, const uint8_t *hex_data, const size_t hex for (; i < minStrLen; i++, tmp += 1) sprintf(tmp, " "); + // remove last space + --tmp; + *tmp = '\0'; return; } @@ -346,7 +349,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) { memset(buf, 0x00, UTIL_BUFFER_SIZE_SPRINT); size_t max_len = (len > 1010) ? 1010 : len; - snprintf(tmp, UTIL_BUFFER_SIZE_SPRINT, "%s| ", sprint_hex(data, max_len)); + snprintf(tmp, UTIL_BUFFER_SIZE_SPRINT, "%s | ", sprint_hex(data, max_len)); size_t i = 0; size_t pos = (max_len * 3) + 2;