summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authornicm <nicm>2015-07-13 18:10:26 +0000
committernicm <nicm>2015-07-13 18:10:26 +0000
commit4e637b1b610f93d474a60daa4ab78afef66b29bc (patch)
treef43ca841ac1c808ebb9c05c11b45c70fc1775f3a /client.c
parente45d624df288d914a1628d373ff245b03f7d600b (diff)
Ignore environment variables that are too long to send to the server.
Diffstat (limited to 'client.c')
-rw-r--r--client.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/client.c b/client.c
index 4b7bbb1f..63432926 100644
--- a/client.c
+++ b/client.c
@@ -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);