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

Semi-bug "long-usernames":

Bump username storage from 32 to 100 chars. Also replaced a couple of magic
numbers with sizeof in ssh.c.
I don't believe this is going to startle any of the protocols PuTTY talks.

[originally from svn r1952]
This commit is contained in:
Jacob Nevins 2002-09-12 16:05:05 +00:00
parent c7fa2f6183
commit 9f9739602b
2 changed files with 6 additions and 6 deletions

View File

@ -276,8 +276,8 @@ typedef struct {
char termtype[32]; char termtype[32];
char termspeed[32]; char termspeed[32];
char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */ char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
char username[32]; char username[100];
char localusername[32]; char localusername[100];
int rfc_environ; int rfc_environ;
int passive_telnet; int passive_telnet;
/* Keyboard options */ /* Keyboard options */

8
ssh.c
View File

@ -2362,8 +2362,8 @@ static int do_ssh1_login(unsigned char *in, int inlen, int ispkt)
c_write_str("\r\n"); c_write_str("\r\n");
} }
} else { } else {
strncpy(username, cfg.username, 99); strncpy(username, cfg.username, sizeof(username));
username[99] = '\0'; username[sizeof(username)-1] = '\0';
} }
send_packet(SSH1_CMSG_USER, PKT_STR, username, PKT_END); send_packet(SSH1_CMSG_USER, PKT_STR, username, PKT_END);
@ -4182,8 +4182,8 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
username[strcspn(username, "\n\r")] = '\0'; username[strcspn(username, "\n\r")] = '\0';
} else { } else {
char stuff[200]; char stuff[200];
strncpy(username, cfg.username, 99); strncpy(username, cfg.username, sizeof(username));
username[99] = '\0'; username[sizeof(username)-1] = '\0';
if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) { if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE)) {
sprintf(stuff, "Using username \"%s\".\r\n", username); sprintf(stuff, "Using username \"%s\".\r\n", username);
c_write_str(stuff); c_write_str(stuff);