stefankueng / CryptSync

CryptSync is a small utility that synchronizes two folders while encrypting the contents in one folder. That means one of the two folders has all files unencrypted (the files you work with) and the other folder has all the files encrypted.
https://tools.stefankueng.com/CryptSync.html
GNU General Public License v3.0
400 stars 72 forks source link

No functional change. Only adjustments. #121

Closed dansyl1 closed 4 months ago

dansyl1 commented 4 months ago

Adjusted declaration of m_buffer to explicitly force DWORD-alignment: as per https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-readdirectorychangesw, the buffer passed to ReadDirectoryChangesW() must be DWORD-aligned.

Added CTraceToOutputDebugString to help troubleshooting. Additions are in effect if, and only if, _DEBUG is defined.

Removed first check for buffer overrun on line 199, previous statement result in the calculation always being zero. Buffer overrun check is now only done at the top of the loop.

Removed unnecessary calculation of nOffset before loop.

Replaced wcsncat_s() by wmemmove_s() to prevent source buffer read overrun, which, if Windows fills the m_buffer to capacity, might trigger an exception.

Consolidated two re-calculations for next pnotify.