mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Fix various segfaults and heap trashes. Thanks to Andrew Mobbs.
[originally from svn r29]
This commit is contained in:
parent
3b1389a474
commit
ee9e246617
4
noise.c
4
noise.c
@ -73,7 +73,7 @@ void noise_get_heavy(void (*func) (void *, int)) {
|
|||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
NULL, OPEN_EXISTING, 0, NULL);
|
NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
if (seedf) {
|
if (seedf != INVALID_HANDLE_VALUE) {
|
||||||
while (1) {
|
while (1) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
DWORD len;
|
DWORD len;
|
||||||
@ -96,7 +96,7 @@ void random_save_seed(void) {
|
|||||||
seedf = CreateFile(seedpath, GENERIC_WRITE, 0,
|
seedf = CreateFile(seedpath, GENERIC_WRITE, 0,
|
||||||
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
|
||||||
if (seedf) {
|
if (seedf != INVALID_HANDLE_VALUE) {
|
||||||
int len;
|
int len;
|
||||||
DWORD lenwritten;
|
DWORD lenwritten;
|
||||||
void *data;
|
void *data;
|
||||||
|
4
ssh.c
4
ssh.c
@ -174,8 +174,8 @@ static void s_wrpkt_start(int type, int len) {
|
|||||||
pktout.length = len-5;
|
pktout.length = len-5;
|
||||||
if (pktout.maxlen < biglen) {
|
if (pktout.maxlen < biglen) {
|
||||||
pktout.maxlen = biglen;
|
pktout.maxlen = biglen;
|
||||||
pktout.data = (pktout.data == NULL ? malloc(biglen) :
|
pktout.data = (pktout.data == NULL ? malloc(biglen+4) :
|
||||||
realloc(pktout.data, biglen));
|
realloc(pktout.data, biglen+4));
|
||||||
if (!pktout.data)
|
if (!pktout.data)
|
||||||
fatalbox("Out of memory");
|
fatalbox("Out of memory");
|
||||||
}
|
}
|
||||||
|
2
windlg.c
2
windlg.c
@ -116,7 +116,6 @@ static void save_settings (char *section, int do_host) {
|
|||||||
|
|
||||||
if (RegCreateKey(HKEY_CURRENT_USER, puttystr, &subkey1)!=ERROR_SUCCESS ||
|
if (RegCreateKey(HKEY_CURRENT_USER, puttystr, &subkey1)!=ERROR_SUCCESS ||
|
||||||
RegCreateKey(subkey1, p, &sesskey) != ERROR_SUCCESS) {
|
RegCreateKey(subkey1, p, &sesskey) != ERROR_SUCCESS) {
|
||||||
free(p);
|
|
||||||
sesskey = NULL;
|
sesskey = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +220,6 @@ static void load_settings (char *section, int do_host) {
|
|||||||
|
|
||||||
if (RegOpenKey(HKEY_CURRENT_USER, puttystr, &subkey1) != ERROR_SUCCESS ||
|
if (RegOpenKey(HKEY_CURRENT_USER, puttystr, &subkey1) != ERROR_SUCCESS ||
|
||||||
RegOpenKey(subkey1, p, &sesskey) != ERROR_SUCCESS) {
|
RegOpenKey(subkey1, p, &sesskey) != ERROR_SUCCESS) {
|
||||||
free(p);
|
|
||||||
sesskey = NULL;
|
sesskey = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
window.c
3
window.c
@ -1347,7 +1347,8 @@ void set_sbar (int total, int start, int page) {
|
|||||||
si.nMax = total - 1;
|
si.nMax = total - 1;
|
||||||
si.nPage = page;
|
si.nPage = page;
|
||||||
si.nPos = start;
|
si.nPos = start;
|
||||||
SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
|
if (hwnd)
|
||||||
|
SetScrollInfo (hwnd, SB_VERT, &si, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Context get_ctx() {
|
Context get_ctx() {
|
||||||
|
Loading…
Reference in New Issue
Block a user