[Issue 961] New: std.windows.registry stack corruption

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 13 22:23:13 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=961

           Summary: std.windows.registry stack corruption
           Product: D
           Version: unspecified
          Platform: PC
               URL: http://www.digitalmars.com/webnews/newsgroups.php?art_gr
                    oup=digitalmars.D.bugs&article_id=9971
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: technocrat7 at gmail.com


Jay Jacobson created a patch that seems to fix some bugs in
std.windows.registry. Without the patch, my registry programs didn't work quite
right, but after applying his patch, my programs worked fine.

<Quote>
The first was on line 691 and had to do with setting the cbData value to be the
size of a DWORD 8. This lead to the odd problem pointed at in the previous
post. This caused all string registry values with a size less than 8 to become
corrupted because the fall-through test of "too small a buffer" was skipped. In
the case of a string, you can't know what the size is in advance without first
calling the function to obtain the correct size to allocate. The subsequent
call then works (the fall-through test).

Unfortunately, the one liner fix caused the DWORD registry entries to not be
read correctly which lead to the addition of the case statement to
appropriately set the "data" variable ptr (might be a better way to do this).

Additionally, I found that the EXPAND_SZ method was not stripping a trailing
NULL from the ExpandEnvironmentStringsA call.
</Quote>


-- 



More information about the Digitalmars-d-bugs mailing list