Bug 446: SetFileAttributes and BufferOverflow

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Sat May 4 12:55:42 CDT 2002


Looking at Bugzilla bug 446 and the msdn, it would appear (and testing
confirms) that:

rc = SetFileAttributes("fff", FILE_ATTRIBUTE_NORMAL |
FILE_ATTRIBUTE_READONLY );

_is_ valid and sets readonly. In the msdn "However, all other values
override FILE_ATTRIBUTE_NORMAL."

The wine code (files\file.c) prints a fixme if anything is set alongside
attribute_normal:
    if (attributes & FILE_ATTRIBUTE_NORMAL) {
      attributes &= ~FILE_ATTRIBUTE_NORMAL;
      if (attributes)
        FIXME("(%s):%lx illegal combination with FILE_ATTRIBUTE_NORMAL.\n",
lpFileName,attributes);
    }

I would suggest a trace point rather than a fixme or remove this check
altogether

As to the buffer overflow, the only thought I have is a missing \n on the
end of the error msg:

        if (!S_ISDIR(buf.st_mode))
            FIXME("SetFileAttributes expected the file '%s' to be a
directory",
                  lpFileName);

Thoughts?
I can submit a patch for these simple issues, but I cant explain the other
issues (re files expected to be directories)

Regards,
Jason




More information about the wine-devel mailing list