<i>registry keys command fails with 8.5/8.6</i> status still Open with 4 other changes
by
.
D 2011-07-11T14:07:44
J icomment Tracing\sthrough\sthe\scode,\sthe\sfailure\sis\sin\stclWinReg.c:GetKeyNames.\sThe\scode\scalls\sRegQueryInfoKey\sto\sget\snumber\sof\skeys\sand\smax\slength,\sallocates\sa\sbuffer\sand\siterates\sthrough\sthe\snumber\sof\skeys.\n\nThere\sare\sseveral\sproblems\sin\sthis\sfunction:\n\n-\srace\scondition\s-\sthe\smax\slength\sAND/OR\snumber\sof\skeys\scan\schange\sduring\sthe\siteration\s(if\sanother\sthread/process\smodified/adds/deletes\sa\skey),\scausing\sthe\sfunction\sto\sfail\swith\seither\sERROR_MORE_DATA\sor\sERROR_NO_MORE_ITEMS\n-\sThere\sis\sa\smemory\sleak\sin\scase\sof\serrors\n-\sThere\sis\sbuffer\soverflow,\sI\sbelieve,\sif\sthe\scode\sis\scompiled\swithout\s_UNICODE\sdefined\s(this\smay\snot\smatter\sanymore).\sThe\scall\sto\sTcl_WinTCharToUtf\sshould\suse\ssizeof(TCHAR),\snot\ssizeof(WCHAR)\sI\sbelieve.\n\nIronially\senough,\snone\sof\sthe\sabove\sis\sthe\scause\sof\sthe\sobserved\sfailure.\sThe\sapparent\sreason\sis\sthat\sRegQueryInfoKey\sdoes\snot\salways\sreturn\sthe\scorrect\sinformation\swhen\sthe\sUnicode\sversion\sis\sused\sand\sthe\soriginal\skey\swas\sstored\susing\sa\sMBCS\scall\s(this\sis\sjust\sscuttlebutt\sbut\sseems\sto\smatch\sthe\scircumstantial\sevidence).\sSo\sthe\smax\slength\sassumed\sby\sthe\sfunction\sis\sin\sfact\stoo\ssmall.\sI\sverified\sthis\sin\sVisual\sStudio\s-\sthe\s"Internet\sExplorer"\skey\sis\s17\schars,\sbut\sthe\sreturned\smax\sby\sRegQueryInfoKey\sis\sonly\s12.\sThis\sis\sreally\sthen\san\sMS\sbug,\sbut\stheir\sposition\sis\sthat\sRegQueryInfoKey\sreturn\svalues\scannot\sbe\srelied\supon\sand\sthe\ssample\siterative\smethod\sin\sthe\ssdk\sshould\sbe\sfollowed.\n\nPatch\sto\sfollow...\n\n/Ashok\n
J login apnadkarni
J mimetype text/plain
J username apnadkarni
K 3362446fffffffffffffffffffffffffffffffff
U apnadkarni
Z b2a75396e2d9b37b8f6aba79bd88c44a