Skip to content

Commit

Permalink
Merge pull request #164 from r00tcxx/master
Browse files Browse the repository at this point in the history
Fix issue with ReadDirectoryChangesW API on Win32 when buffer overflows
  • Loading branch information
SpartanJ authored Aug 26, 2023
2 parents 6187b49 + 25a3346 commit 19398b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/efsw/WatcherWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace efsw {

/// Unpacks events and passes them to a user defined callback.
void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped ) {
if ( dwNumberOfBytesTransfered == 0 || NULL == lpOverlapped ) {

if ( NULL == lpOverlapped ) {
return;
}

Expand All @@ -19,6 +20,14 @@ void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOve
WatcherWin32* pWatch = tWatch->Watch;
size_t offset = 0;

if ( dwNumberOfBytesTransfered == 0 ) {
if ( nullptr != pWatch && !pWatch->StopNow ) {
RefreshWatch( tWatch );
} else {
return;
}
}

do {
bool skip = false;

Expand Down

0 comments on commit 19398b8

Please sign in to comment.