bpo-33001: Minimal fix to prevent buffer overrun in os.symlink by zooba ยท Pull Request #5989 ยท python/cpython

Conversation

@zooba zooba changed the title Minimal fix to prevent buffer overrun in os.symlink bpo-33001: Minimal fix to prevent buffer overrun in os.symlink

Mar 5, 2018

@bedevere-bot

izbyshev

# overflow dest with relative src
(segment, path),
# overflow dest when appending '\\' for join
(segment, path[:261]),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this won't overflow when appending \\ because:

  • len(path[:261]) > MAX_PATH - 1, so it'll overflow in the very beginning of _check_dirW
  • even if len was equal to MAX_PATH - 1, _dirnameW would be applied first, making it shorter.

@miss-islington

Thanks @zooba for the PR ๐ŸŒฎ๐ŸŽ‰.. I'm working now to backport this PR to: 3.7.
๐Ÿ๐Ÿ’โ›๐Ÿค–

zooba added a commit that referenced this pull request

Mar 5, 2018

@zooba zooba deleted the symlink-bug branch

March 5, 2018 22:27

@bedevere-bot

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Mar 5, 2018
(cherry picked from commit 6921e73)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>

miss-islington added a commit that referenced this pull request

Mar 5, 2018
(cherry picked from commit 6921e73)

Co-authored-by: Steve Dower <steve.dower@microsoft.com>

jo2y pushed a commit to jo2y/cpython that referenced this pull request

Mar 23, 2018

larryhastings pushed a commit that referenced this pull request

May 14, 2018
* bpo-33001: Minimal fix to prevent buffer overrun in os.symlink

* Skips test to avoid crashing during the test suite

* Remove invalid test

larryhastings pushed a commit that referenced this pull request

May 14, 2018
* bpo-33001: Minimal fix to prevent buffer overrun in os.symlink

* Remove invalid test

Labels