diff --git a/kernel/src/utils/string.c b/kernel/src/utils/string.c index ec3bcd6..79fba97 100644 --- a/kernel/src/utils/string.c +++ b/kernel/src/utils/string.c @@ -71,7 +71,12 @@ uint64_t variadic_format_size(string_t string, va_list args) { } case 's': { // string - uint64_t strlen = string_length(va_arg(args, string_t)); + string_t str = va_arg(args, string_t); + if (str == NULL) { + str = ""; + } + + uint64_t strlen = string_length(str); if (numeric_specifier > 0) { strlen = MIN(strlen, numeric_specifier); } @@ -201,7 +206,10 @@ void variadic_format(string_t output, string_t string, va_list args) { } case 's': { // string - string_t str = va_arg(args, string_t); + string_t str = va_arg(args, string_t); + if (str == NULL) { + str = ""; + } uint64_t strlen = string_length(str); if (numeric_specifier > 0) {