https://bugs.kde.org/show_bug.cgi?id=482137

--- Comment #21 from Fabio <ctrlal...@gmail.com> ---
(In reply to Marcel Hasler from comment #20)
> I guess that warning came too late, the same thing is in fact already being
> done in other places. As a test I printed the proxy and gateway settings
> with qDebug() just before the call to freerdp_connect(). As expected the
> output is complete garbage and after the message that it cannot connect,
> krdc crashes.
> 
> According to the sources it looks like freerdp actually takes ownership of
> all settings strings and frees them on exit, so using strdup (or _strdup
> from <winpr/string.h> or std::strdup once available) would be the correct
> solution here.

Thank you for checking the rest of the code.
A MR is already queued that adds support for freerdp3 and also changes the way
all the settings are set, using freerdp_settings_set_string() that internally
calls update_string_copy_(), so that freerdp creates its own copy of the char*
when they still exists.
I guess that should fix the other issues you found, see eg.:
https://invent.kde.org/network/krdc/-/merge_requests/113/diffs?commit_id=e1c9965f52d0aa7e2e0d9d02f9b4417914ea8748#22035f78003a0693934d972e85db265b9deaa2f4_474_574


> 
> qstrdup is already used for ServerHostname, Username and Password. I would,
> however, recommend using C strdup, because qstrdup uses new[] to allocate
> the string which should be deallocated with delete[] accordingly, whereas
> freerdp naturally uses free() instead. So using qstrdup to copy the strings
> would once again be UB.

Thanks, will integrate this in the MR

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to