1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-18 11:31:00 -05:00

psusan: fix assertion failure in SFTP server.

Uppity's built-in SFTP server makes up its file handle identifiers
using random_read(). But when that server is reused in psusan, which
doesn't have the random number generator enabled, you get an assertion
failure.
This commit is contained in:
Simon Tatham
2020-11-04 21:50:47 +00:00
parent 9ea0dfd8c0
commit 3a9b7267dd
4 changed files with 20 additions and 1 deletions

View File

@ -84,6 +84,16 @@ void timer_change_notify(unsigned long next)
char *platform_get_x_display(void) { return NULL; }
void make_unix_sftp_filehandle_key(void *vdata, size_t size)
{
/* psusan runs without a random number generator, so we can't make
* this up by random_read. Fortunately, psusan is also
* non-adversarial, so it's safe to generate this trivially. */
unsigned char *data = (unsigned char *)vdata;
for (size_t i = 0; i < size; i++)
data[i] = (unsigned)rand() / ((unsigned)RAND_MAX / 256);
}
static bool verbose;
struct server_instance {