1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Remove a fixed-size buffer in pscp.c.

Pavel Kryukov reports that gcc 8 didn't like that buffer being the
same size as the one from which I was sprintf("%s")ing into it. The
easiest fix is to stop trying to guess buffer sizes and use dupprintf.
This commit is contained in:
Simon Tatham 2018-09-22 12:22:07 +01:00
parent f7821f530f
commit 5eb4efce01

5
pscp.c
View File

@ -852,13 +852,14 @@ int scp_send_filename(const char *name, uint64 size, int permissions)
sfree(fullname);
return 0;
} else {
char buf[40];
char *buf;
char sizestr[40];
uint64_decimal(size, sizestr);
if (permissions < 0)
permissions = 0644;
sprintf(buf, "C%04o %s ", (int)(permissions & 07777), sizestr);
buf = dupprintf("C%04o %s ", (int)(permissions & 07777), sizestr);
backend_send(backend, buf, strlen(buf));
sfree(buf);
backend_send(backend, name, strlen(name));
backend_send(backend, "\n", 1);
return response();