~vcs-imports/putty/master

Viewing all changes in revision 5530.

  • Committer: Simon Tatham
  • Author(s): Nastasie Ion Octavian
  • Date: 2019-08-04 14:38:11 UTC
  • Revision ID: git-v1:efcf164abe29eaf3357a63219830af4a71058af4
Fix enum_settings_next() to handle subkeys with 256 characters long names.

Set the initial buffer size to MAX_PATH + 1 (261). Increment e->i before
the function returns instead of incrementing it in the call to
RegEnumKey.

The initial buffer size was too small to fit a subkey with a 256
characters long name plus '\0', the first call to RegEnumKey would fail
with ERROR_MORE_DATA, sgrowarray would grow the buffer, and RegEnumKey
would be called again.

However, because e->i was incremented in the first RegEnumKey call, the
second call would get the next subkey and the subkey with the long name
would be skipped.

Saving a session with a 256 characters long name would trigger this
problem. The session would be saved in the registry, but Putty would not
be able to display it in the saved sessions list.

Pageant didn't have this problem since it uses a different function to get
the saved sessions and the size of the buffer used is MAX_PATH + 1. Pageant
and Putty would display slightly different lists of saved sessions.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: