Skip to content

Commit 554a481

Browse files
committed
fix: use unsigned char cast and sizeof in LogEscape escape sequence
1 parent 22bec91 commit 554a481

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mp/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ std::string LogEscape(const kj::StringTree& string, size_t max_size)
102102
result.append("\\\\");
103103
} else if (c < 0x20 || c > 0x7e) {
104104
char escape[4];
105-
snprintf(escape, 4, "\\%02x", c);
105+
snprintf(escape, sizeof(escape), "\\%02x", static_cast<unsigned char>(c));
106106
result.append(escape);
107107
} else {
108108
result.push_back(c);

0 commit comments

Comments
 (0)