mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
unescape & in PassStub (#8183)
* unescape & in PassStub windows sometimes creates .msrcincident file with escaped ampersand as `&` in PassStub. Need to unescape or server will deny connection and complain about incorrect password. * Update assistance.c
This commit is contained in:
@@ -742,6 +742,7 @@ int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file, const char* bu
|
||||
char* p;
|
||||
char* q;
|
||||
char* r;
|
||||
char* amp;
|
||||
int status;
|
||||
size_t length;
|
||||
|
||||
@@ -894,6 +895,10 @@ int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file, const char* bu
|
||||
if (p)
|
||||
{
|
||||
p += sizeof("PassStub=\"") - 1;
|
||||
|
||||
// needs to be unescaped (& => &)
|
||||
amp = strstr(p, "&");
|
||||
|
||||
q = strchr(p, '"');
|
||||
|
||||
if (!q)
|
||||
@@ -909,13 +914,31 @@ int freerdp_assistance_parse_file_buffer(rdpAssistanceFile* file, const char* bu
|
||||
return -1;
|
||||
}
|
||||
|
||||
length = q - p;
|
||||
if (amp)
|
||||
{
|
||||
length = q - p - 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
length = q - p;
|
||||
}
|
||||
|
||||
file->PassStub = (char*)malloc(length + 1);
|
||||
|
||||
if (!file->PassStub)
|
||||
return -1;
|
||||
|
||||
CopyMemory(file->PassStub, p, length);
|
||||
if (amp)
|
||||
{
|
||||
// just skip over "amp;" leaving "&"
|
||||
CopyMemory(file->PassStub, p, amp - p + 1);
|
||||
CopyMemory(file->PassStub + (amp - p + 1), amp + 5, q - amp + 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyMemory(file->PassStub, p, length);
|
||||
}
|
||||
|
||||
file->PassStub[length] = '\0';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user