From 165bfa3dd6ce9a9b695f522fbd6b94b4608fe876 Mon Sep 17 00:00:00 2001 From: Dan Sorahan Date: Thu, 4 May 2017 12:38:19 +0100 Subject: [PATCH] Fix hex encoding of non-ASCII characters in serial --- src/lib/shared/SerialKey.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/shared/SerialKey.cpp b/src/lib/shared/SerialKey.cpp index bb78d981..7a47adfb 100644 --- a/src/lib/shared/SerialKey.cpp +++ b/src/lib/shared/SerialKey.cpp @@ -114,7 +114,8 @@ static std::string hexEncode (std::string const& str) { std::ostringstream oss; for (size_t i = 0; i < str.size(); ++i) { - int c = str[i]; + unsigned c = str[i]; + c %= 256; oss << std::setfill('0') << std::hex << std::setw(2) << std::uppercase; oss << c;