Ignore environment variables that are too long to send to the server.

pull/1165/head
nicm 2015-07-13 18:10:26 +00:00
parent e45d624df2
commit 4e637b1b61
1 changed files with 6 additions and 2 deletions

View File

@ -350,6 +350,7 @@ client_send_identify(int flags)
{
const char *s;
char **ss;
size_t sslen;
int fd;
pid_t pid;
@ -374,8 +375,11 @@ client_send_identify(int flags)
pid = getpid();
client_write_one(MSG_IDENTIFY_CLIENTPID, -1, &pid, sizeof pid);
for (ss = environ; *ss != NULL; ss++)
client_write_one(MSG_IDENTIFY_ENVIRON, -1, *ss, strlen(*ss) + 1);
for (ss = environ; *ss != NULL; ss++) {
sslen = strlen(*ss) + 1;
if (sslen <= MAX_IMSGSIZE - IMSG_HEADER_SIZE)
client_write_one(MSG_IDENTIFY_ENVIRON, -1, *ss, sslen);
}
client_write_one(MSG_IDENTIFY_DONE, -1, NULL, 0);