From 575186c43c3832a95a92c2cc88c1dc9cdac33102 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 10 Sep 2016 03:19:46 +0200 Subject: [PATCH] respondd: ensure new_task->request doesn't overflow and is zero terminated --- net/respondd/src/respondd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/respondd/src/respondd.c b/net/respondd/src/respondd.c index 89e5946..10ab482 100644 --- a/net/respondd/src/respondd.c +++ b/net/respondd/src/respondd.c @@ -465,7 +465,8 @@ static void accept_request(struct request_schedule *schedule, int sock, struct request_task *new_task = malloc(sizeof(struct request_task)); new_task->scheduled_time = now + delay; - strcpy(new_task->request, input); + strncpy(new_task->request, input, input_bytes + 1); + new_task->request[input_bytes] = 0; memcpy(&new_task->client_addr, &addr, addrlen); if (!schedule_push_request(schedule, new_task)) {