From 7ab14c2b4e4b702e56298b61290229c41455c6d5 Mon Sep 17 00:00:00 2001 From: david-fritz-gravwell <108741881+david-fritz-gravwell@users.noreply.github.com> Date: Mon, 6 Mar 2023 07:50:30 -0700 Subject: [PATCH] Use underlying type in default case in CompletionCode stringer Not using the underlying type results in a stack overflow, as fmt.Sprintf will call the type's stringer regardless of formatting options. Use the underlying uint8 type instead. --- command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command.go b/command.go index c42cfbe..cda3155 100644 --- a/command.go +++ b/command.go @@ -91,7 +91,7 @@ func (c CompletionCode) String() string { case CompletionIllegalCommandDisabled: return "Command sub-function has been disabled or is unavailable" default: - return fmt.Sprintf("0x%02x", c) + return fmt.Sprintf("0x%02x", uint8(c)) } }