From 8a990644c05c9980e90a30d621e7fe9a0b47c144 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 11 Sep 2024 23:09:34 +0200 Subject: [PATCH] [warnings] fix missing NULL assert/check --- client/common/cmdline.c | 2 ++ winpr/libwinpr/clipboard/test/TestUri.c | 2 +- winpr/libwinpr/sspi/sspi_winpr.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 91c25b5e7..e57b8c88b 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -4558,6 +4558,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( } CommandLineSwitchCase(arg, "load-balance-info") { + WINPR_ASSERT(arg->Value); if (!freerdp_settings_set_pointer_len(settings, FreeRDP_LoadBalanceInfo, arg->Value, strlen(arg->Value))) return fail_at(arg, COMMAND_LINE_ERROR); @@ -4761,6 +4762,7 @@ static int freerdp_client_settings_parse_command_line_arguments_int( ConvertWCharNToUtf8(info.TimeZoneKeyName, ARRAYSIZE(info.TimeZoneKeyName), TimeZoneKeyName, ARRAYSIZE(TimeZoneKeyName)); + WINPR_ASSERT(arg->Value); if (strncmp(TimeZoneKeyName, arg->Value, ARRAYSIZE(TimeZoneKeyName)) == 0) { found = TRUE; diff --git a/winpr/libwinpr/clipboard/test/TestUri.c b/winpr/libwinpr/clipboard/test/TestUri.c index c1cccd31a..3f78f2e6f 100644 --- a/winpr/libwinpr/clipboard/test/TestUri.c +++ b/winpr/libwinpr/clipboard/test/TestUri.c @@ -44,7 +44,7 @@ int TestUri(int argc, char* argv[]) const char* cmp = input[i + 1]; int bTest = 0; char* name = parse_uri_to_local_file(in, strlen(in)); - if (name) + if (name && cmp) { bTest = !strcmp(name, cmp); if (!bTest) diff --git a/winpr/libwinpr/sspi/sspi_winpr.c b/winpr/libwinpr/sspi/sspi_winpr.c index c3a5bd64a..3b291e4a8 100644 --- a/winpr/libwinpr/sspi/sspi_winpr.c +++ b/winpr/libwinpr/sspi/sspi_winpr.c @@ -333,6 +333,10 @@ static BOOL copy(WCHAR** dst, ULONG* dstLen, const WCHAR* what, size_t len) *dst = NULL; *dstLen = 0; + if (!what && (len != 0)) + return FALSE; + if (len == 0) + return TRUE; *dst = calloc(sizeof(WCHAR), len + 1); if (!*dst) return FALSE;