From d2c6115f6f0fb9e82e629585c2d132d8f4c555c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20Ho=CC=88ner?= Date: Tue, 17 Oct 2017 17:44:19 +0200 Subject: [PATCH] Fixed two formatter issues - Unintentional fallthrough - Assertion on 0-length append --- src/FormatHelper.c | 2 ++ src/Formatter.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/FormatHelper.c b/src/FormatHelper.c index 39a09a9..bf1a958 100644 --- a/src/FormatHelper.c +++ b/src/FormatHelper.c @@ -332,8 +332,10 @@ ZydisStatus ZydisPrintStr(char** buffer, size_t bufferLen, const char* text, break; case ZYDIS_LETTER_CASE_LOWER: ZydisToLowerCase(*buffer, strLen); + break; case ZYDIS_LETTER_CASE_UPPER: ZydisToUpperCase(*buffer, strLen); + break; default: ZYDIS_UNREACHABLE; } diff --git a/src/Formatter.c b/src/Formatter.c index 3943ed9..3368b05 100644 --- a/src/Formatter.c +++ b/src/Formatter.c @@ -464,7 +464,7 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for } if (typecast) { - char* str = ""; + const char* str = NULL; switch (typecast) { case 8: @@ -497,7 +497,11 @@ static ZydisStatus ZydisFormatterPrintOperandSizeIntel(const ZydisFormatter* for default: break; } - return ZydisPrintStr(buffer, bufferLen, str, ZYDIS_LETTER_CASE); + + if (str) + { + return ZydisPrintStr(buffer, bufferLen, str, ZYDIS_LETTER_CASE); + } } return ZYDIS_STATUS_SUCCESS; }