From d0b4bb8afc4e135aeb08dcc310631cb95ba96b79 Mon Sep 17 00:00:00 2001 From: ada christine <45108022+adachristine@users.noreply.github.com> Date: Thu, 10 Feb 2022 18:22:28 +0000 Subject: missing nul check in type width argument --- kc/core/kprint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kc/core/kprint.c') diff --git a/kc/core/kprint.c b/kc/core/kprint.c index 18b5af9..70010ea 100644 --- a/kc/core/kprint.c +++ b/kc/core/kprint.c @@ -148,7 +148,9 @@ static struct specifier parse_specifier(const char *format, va_list arguments) // step 3: check for type width arguments switch (*begin) - { + case 0: // unexpected eos + result.type = INVALID_PRINT; + return result; case 'h': { if (begin[0] == begin[1]) -- cgit v1.3.1-1-g115d