os: fix missing NULL check for vpnprintf()

Protect from NULL parameter to %s directive.

See also: https://github.com/X11Libre/xserver/issues/36

Signed-off-by: Herman Semenov <GermanAizek@yandex.ru>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Hermann Semenov 2025-06-11 16:43:31 +03:00 committed by Enrico Weigelt, metux IT consult
parent fa7cc111e7
commit d042e5a667

View File

@ -449,8 +449,10 @@ vpnprintf(char *string, int size_in, const char *f, va_list args)
case 's':
string_arg = va_arg(args, char*);
if (string_arg) {
for (i = 0; string_arg[i] != 0 && s_idx < size - 1 && s_idx < precision; i++)
string[s_idx++] = string_arg[i];
}
break;
case 'u':