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
This commit is contained in:
Eduard Permyakov 2021-11-19 16:45:02 +03:00 committed by Arkadiusz Hiler
parent 2ad85256a3
commit d6aec09c05

View file

@ -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;