1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-15 01:57:40 -05:00

Jordan Russell's patch (again): a couple of registry read operations

were using RegCreateKey instead of RegOpenKey by mistake. This also
required a fix in settings.c to deal gracefully with a NULL return
from enum_settings_start() - since the use of RCK had caused this
never to happen, the code path had never been tested.

[originally from svn r1516]
This commit is contained in:
Simon Tatham
2001-12-29 14:18:51 +00:00
parent 7423036505
commit 66a53cd2c0
2 changed files with 17 additions and 18 deletions

View File

@ -565,24 +565,23 @@ void get_sesslist(int allocate)
if (allocate) {
if ((handle = enum_settings_start()) == NULL)
return;
buflen = bufsize = 0;
buffer = NULL;
do {
ret = enum_settings_next(handle, otherbuf, sizeof(otherbuf));
if (ret) {
int len = strlen(otherbuf) + 1;
if (bufsize < buflen + len) {
bufsize = buflen + len + 2048;
buffer = srealloc(buffer, bufsize);
if ((handle = enum_settings_start())) {
do {
ret = enum_settings_next(handle, otherbuf, sizeof(otherbuf));
if (ret) {
int len = strlen(otherbuf) + 1;
if (bufsize < buflen + len) {
bufsize = buflen + len + 2048;
buffer = srealloc(buffer, bufsize);
}
strcpy(buffer + buflen, otherbuf);
buflen += strlen(buffer + buflen) + 1;
}
strcpy(buffer + buflen, otherbuf);
buflen += strlen(buffer + buflen) + 1;
}
} while (ret);
enum_settings_finish(handle);
} while (ret);
enum_settings_finish(handle);
}
buffer = srealloc(buffer, buflen + 1);
buffer[buflen] = '\0';