Skip to content

Commit

Permalink
Merge pull request #395 from xrobau/patch-1
Browse files Browse the repository at this point in the history
Fix overflow on SMTP subject line
  • Loading branch information
davidvossel committed Dec 6, 2013
2 parents e7385d4 + b1515e3 commit 9663a1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/crm_mon.c
@@ -1,4 +1,3 @@

/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
Expand Down Expand Up @@ -2094,7 +2093,7 @@ send_smtp_trap(const char *node, const char *rsc, const char *task, int target_r
auth_context_t authctx;
struct sigaction sa;

int len = 20;
int len = 25; /* Note: Check extra padding on the Subject line below */
int noauth = 1;
int smtp_debug = LOG_DEBUG;
char crm_mail_body[BODY_MAX];
Expand Down Expand Up @@ -2134,6 +2133,7 @@ send_smtp_trap(const char *node, const char *rsc, const char *task, int target_r
len++;

crm_mail_subject = calloc(1, len);
/* If you edit this line, ensure you allocate enough memory for it by altering 'len' above */
snprintf(crm_mail_subject, len, "%s - %s event for %s on %s: %s\r\n", crm_mail_prefix, task,
rsc, node, desc);

Expand Down

0 comments on commit 9663a1b

Please sign in to comment.