From d6aec09c05da32cac6b1da0299089add6257ba0e Mon Sep 17 00:00:00 2001 From: Eduard Permyakov Date: Fri, 19 Nov 2021 16:45:02 +0300 Subject: [PATCH] lsteamclient: Fix forwarding incorrect result for certain path-related operations. The SteamAPI may return non-zero values even when a NULL pointer is passed in for the target path buffer. For example, GetAppInstallDir will still return the required size of the distination buffer. Since api_result is the length of the Windows path, it is not completely safe to return it directly, since the corresponding UNIX path may have more characters. Without access to the original Windows path, we cannot make a conversion to determine how many characters the UNIX path will have. So just resort to returning a safe upper bound value. CW-Bug-Id: #19606 --- lsteamclient/steamclient_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsteamclient/steamclient_main.c b/lsteamclient/steamclient_main.c index d4cccb40..36c22e89 100644 --- a/lsteamclient/steamclient_main.c +++ b/lsteamclient/steamclient_main.c @@ -86,7 +86,7 @@ unsigned int steamclient_unix_path_to_dos_path(bool api_result, const char *src, static const char file_prot[] = "file://"; if(!dst || !dst_bytes) - return 0; + return PATH_MAX - 1; if(!src || !*src || !api_result){ *dst = 0;