Blame SOURCES/0010-cache-Fix-features-array-allocation.patch

4a3166
From 22c02399e51367b8ec1b2e66a4359ae5cd8db4ae Mon Sep 17 00:00:00 2001
4a3166
From: Phil Sutter <phil@nwl.cc>
4a3166
Date: Thu, 24 Mar 2022 18:07:51 +0100
4a3166
Subject: [PATCH] cache: Fix features array allocation
4a3166
4a3166
struct cache::features is of type struct cache_feature **, allocate and
4a3166
populate accordingly.
4a3166
4a3166
Fixes: ad31f852c3454 ("initial import of the conntrack daemon to Netfilter SVN")
4a3166
Signed-off-by: Phil Sutter <phil@nwl.cc>
4a3166
(cherry picked from commit 549f90d8a7847f201aa604a0cf7c24b73d4b5a56)
4a3166
---
4a3166
 src/cache.c | 4 ++--
4a3166
 1 file changed, 2 insertions(+), 2 deletions(-)
4a3166
4a3166
diff --git a/src/cache.c b/src/cache.c
4a3166
index 79a024f8b6bb0..9bc8d0f5bf34a 100644
4a3166
--- a/src/cache.c
4a3166
+++ b/src/cache.c
4a3166
@@ -69,12 +69,12 @@ struct cache *cache_create(const char *name, enum cache_type type,
4a3166
 
4a3166
 	memcpy(c->feature_type, feature_type, sizeof(feature_type));
4a3166
 
4a3166
-	c->features = malloc(sizeof(struct cache_feature) * j);
4a3166
+	c->features = malloc(sizeof(struct cache_feature *) * j);
4a3166
 	if (!c->features) {
4a3166
 		free(c);
4a3166
 		return NULL;
4a3166
 	}
4a3166
-	memcpy(c->features, feature_array, sizeof(struct cache_feature) * j);
4a3166
+	memcpy(c->features, feature_array, sizeof(struct cache_feature *) * j);
4a3166
 	c->num_features = j;
4a3166
 
4a3166
 	c->extra_offset = size;
4a3166
-- 
4a3166
2.34.1
4a3166