From 71e463e31b4d69f4022d36bfc814592f56600793 Mon Sep 17 00:00:00 2001
From: akallabeth <akallabeth@posteo.net>
Date: Sun, 21 Apr 2024 13:56:13 +0200
Subject: [PATCH] [core,info] fix missing check in rdp_write_logon_info_v1

CVE: CVE-2024-32661
Upstream-Status: Backport [https://github.com/FreeRDP/FreeRDP/commit/71e463e31b4d69f4022d36bfc814592f56600793]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
 libfreerdp/core/info.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c
index 7d6eec137..3395e4d2e 100644
--- a/libfreerdp/core/info.c
+++ b/libfreerdp/core/info.c
@@ -1322,6 +1322,10 @@ static BOOL rdp_write_logon_info_v1(wStream* s, logon_info* info)
 		return FALSE;
 
 	/* domain */
+	WINPR_ASSERT(info);
+	if (!info->domain || !info->username)
+		return FALSE;
+
 	ilen = ConvertToUnicode(CP_UTF8, 0, info->domain, -1, &wString, 0);
 
 	if (ilen < 0)
