https://bugs.kde.org/show_bug.cgi?id=482137
--- Comment #20 from Marcel Hasler <mahas...@gmail.com> ---
(In reply to Marcel Hasler from comment #17)
> I can see you are hard to convince, but I'll give it one more shot.
> 
> Please have a look at the test cases I attached. Read them, understand them,
> compile them and run them. If that doesn't convince you, then I guess
> nothing will. But know that even though your code may happen to "work" in
> this case, that's by chance, not by design. If you continue doing stuff like
> that, your luck *will* run out eventually.

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.

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.

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

Reply via email to