mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-27 02:02:26 +00:00
from_backend() should always be called with len > 0. Only rlogin
mode ever failed to do this, and only Plink actually had a problem with it, so this didn't become obvious for a while. rlogin mode is fixed, and all implementations of from_backend() now contain an assertion so that we should spot errors of this type more quickly in future. [originally from svn r1571]
This commit is contained in:
parent
0b61ac21c2
commit
fdbd697801
3
plink.c
3
plink.c
@ -8,6 +8,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
|
#define PUTTY_DO_GLOBALS /* actually _define_ globals */
|
||||||
@ -147,6 +148,8 @@ int from_backend(int is_stderr, char *data, int len)
|
|||||||
HANDLE h = (is_stderr ? errhandle : outhandle);
|
HANDLE h = (is_stderr ? errhandle : outhandle);
|
||||||
int osize, esize;
|
int osize, esize;
|
||||||
|
|
||||||
|
assert(len > 0);
|
||||||
|
|
||||||
if (is_stderr) {
|
if (is_stderr) {
|
||||||
bufchain_add(&stderr_data, data, len);
|
bufchain_add(&stderr_data, data, len);
|
||||||
try_output(1);
|
try_output(1);
|
||||||
|
2
psftp.c
2
psftp.c
@ -1512,6 +1512,8 @@ int from_backend(int is_stderr, char *data, int datalen)
|
|||||||
unsigned char *p = (unsigned char *) data;
|
unsigned char *p = (unsigned char *) data;
|
||||||
unsigned len = (unsigned) datalen;
|
unsigned len = (unsigned) datalen;
|
||||||
|
|
||||||
|
assert(len > 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stderr data is just spouted to local stderr and otherwise
|
* stderr data is just spouted to local stderr and otherwise
|
||||||
* ignored.
|
* ignored.
|
||||||
|
3
rlogin.c
3
rlogin.c
@ -68,7 +68,8 @@ static int rlogin_receive(Plug plug, int urgent, char *data, int len)
|
|||||||
}
|
}
|
||||||
firstbyte = 0;
|
firstbyte = 0;
|
||||||
}
|
}
|
||||||
c_write(data, len);
|
if (len > 0)
|
||||||
|
c_write(data, len);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
2
scp.c
2
scp.c
@ -268,6 +268,8 @@ int from_backend(int is_stderr, char *data, int datalen)
|
|||||||
unsigned char *p = (unsigned char *) data;
|
unsigned char *p = (unsigned char *) data;
|
||||||
unsigned len = (unsigned) datalen;
|
unsigned len = (unsigned) datalen;
|
||||||
|
|
||||||
|
assert(len > 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* stderr data is just spouted to local stderr and otherwise
|
* stderr data is just spouted to local stderr and otherwise
|
||||||
* ignored.
|
* ignored.
|
||||||
|
@ -3603,6 +3603,8 @@ int term_ldisc(int option)
|
|||||||
*/
|
*/
|
||||||
int from_backend(int is_stderr, char *data, int len)
|
int from_backend(int is_stderr, char *data, int len)
|
||||||
{
|
{
|
||||||
|
assert(len > 0);
|
||||||
|
|
||||||
bufchain_add(&inbuf, data, len);
|
bufchain_add(&inbuf, data, len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user