summaryrefslogtreecommitdiff
path: root/src/starter/starterstroke.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2015-04-11 22:03:59 +0200
committerYves-Alexis Perez <corsac@debian.org>2015-04-11 22:30:17 +0200
commit8404fb0212f9fb77bc53b23004b829b488430700 (patch)
tree23876c7540d138f58a6a7d90793ccf9004f6afd2 /src/starter/starterstroke.c
parent1b7c683a32c62b6e08ad7bf5af39b9f4edd634f3 (diff)
downloadvyos-strongswan-8404fb0212f9fb77bc53b23004b829b488430700.tar.gz
vyos-strongswan-8404fb0212f9fb77bc53b23004b829b488430700.zip
Imported Upstream version 5.3.0
Diffstat (limited to 'src/starter/starterstroke.c')
-rw-r--r--src/starter/starterstroke.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/starter/starterstroke.c b/src/starter/starterstroke.c
index 1e305db8b..6e1f1605d 100644
--- a/src/starter/starterstroke.c
+++ b/src/starter/starterstroke.c
@@ -35,10 +35,16 @@ static char* push_string(stroke_msg_t *msg, char *string)
{
unsigned long string_start = msg->length;
- if (string == NULL || msg->length + strlen(string) >= sizeof(stroke_msg_t))
+ if (string == NULL)
{
return NULL;
}
+ else if ((size_t)msg->length + strlen(string) >= sizeof(stroke_msg_t))
+ {
+ /* set invalid length to fail during message send */
+ msg->length = ~0;
+ return NULL;
+ }
else
{
msg->length += strlen(string) + 1;
@@ -53,6 +59,12 @@ static int send_stroke_msg (stroke_msg_t *msg)
char *uri, buffer[64];
int count;
+ if (msg->length > sizeof(stroke_msg_t))
+ {
+ DBG1(DBG_APP, "stroke message exceeds buffer size");
+ return -1;
+ }
+
/* starter is not called from commandline, and therefore absolutely silent */
msg->output_verbosity = -1;