Skip to content

filesystem.cpp: __std_fs_write_reparse_data_buffer() should use the size of the buffer, not buffer pointer - #5976

Closed
AZero13 (AZero13) wants to merge 1 commit into
microsoft:mainfrom
AZero13:next
Closed

filesystem.cpp: __std_fs_write_reparse_data_buffer() should use the size of the buffer, not buffer pointer#5976
AZero13 (AZero13) wants to merge 1 commit into
microsoft:mainfrom
AZero13:next

Conversation

@AZero13

Copy link
Copy Markdown
Contributor

No description provided.

@StephanTLavavej

Copy link
Copy Markdown
Member

This certainly appears to be a bug, after looking into how FSCTL_GET_REPARSE_POINT and FSCTL_SET_REPARSE_POINT work. This codepath is used in a single place, when copying a junction. I'll need to manually exercise this scenario (automated test coverage could potentially be problematic).

@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) added bug Something isn't working filesystem C++17 filesystem labels Dec 31, 2025
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) changed the title Bug: We should use the size of the buffer, not buffer pointer Dec 31, 2025
@StephanTLavavej Stephan T. Lavavej (StephanTLavavej) moved this from Initial Review to Work In Progress in STL Code Reviews Jan 5, 2026
@StephanTLavavej

Copy link
Copy Markdown
Member

We don't think this fix is correct, sizeof(*_Buffer) contains a "fake" array element.

@Morddin

Morddin commented Jan 16, 2026

Copy link
Copy Markdown

After a quick search on the internet, it seems that sizeof(_Buffer) should be replaced with REPARSE_DATA_BUFFER_HEADER_SIZE.

REPARSE_DATA_BUFFER_HEADER_SIZE is defined in the Windows Driver Kit as:

#define REPARSE_DATA_BUFFER_HEADER_SIZE   UFIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)

Its value is 8.

@StephanTLavavej

Copy link
Copy Markdown
Member

Superseded by #6064, thanks everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working filesystem C++17 filesystem

3 participants