[Qt-interest] install message handler

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Thu Sep 2 13:06:51 CEST 2010


On 2010-09-02 Sajjad Sajjad wrote:

> ...
>     g_debugLogFile.setFileName("debugOut.txt");

Are you SURE you are looking at the right output file? Depending on how you set the current working directory that file could be created ANYWHERE on your file system - and maybe you are looking at some old copy of that file which will never get updated!

It is best to always specify ABSOLUTE file paths(1) when reading/writing files: http://doc.trolltech.com/4.6/qcoreapplication.html#applicationDirPath could be helpful (or better: write it somewhere under $HOME etc.)

Cheers, Oliver

Off-topic:

(1) also refer to the "current" problematic of dynamically loading DLLs (with relative file paths) on Windows and how on Windows the CWD can cause malicious DLLs to be loaded (keyword: DLL hijacking). This problem is known for years (especially on Unix, where you usually get punched by a goblin if you add ".' to the LD_LIBRARY_PATH!) and how Microsoft is desperately trying to convince programmers to make their apps secure (keyword: SafeDllSearchMode), (because fixing the problem itself is now too costly ;):

http://www.h-online.com/security/news/item/Microsoft-continues-to-workaround-DLL-vulnerability-1070623.html

http://www.h-online.com/security/news/item/Attackers-exploit-DLL-vulnerability-in-Office-and-other-applications-1068583.html

http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx

Surprisingly (or not) quite some number of applications is affected (including MS Office itself, or so they say ;)

--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22






More information about the Qt-interest-old mailing list