From 466f939ce9f5667dd7d70a72bed9769ed0b4d588 Mon Sep 17 00:00:00 2001
From: Steven Barth <steven@midlink.org>
Date: Thu, 31 Jan 2013 08:38:38 +0100
Subject: [PATCH] Prevent OOM DOS

---
 src/odhcp6c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/odhcp6c.c b/src/odhcp6c.c
index 6a1d1b4..b5665ee 100644
--- a/src/odhcp6c.c
+++ b/src/odhcp6c.c
@@ -317,6 +317,8 @@ static uint8_t* odhcp6c_resize_state(enum odhcp6c_state state, ssize_t len)
 {
 	if (len == 0)
 		return state_data[state] + state_len[state];
+	else if (state_len[state] + len > 1024)
+		return NULL;
 
 	uint8_t *n = realloc(state_data[state], state_len[state] + len);
 	if (n || state_len[state] + len == 0) {
-- 
2.39.5