[conntrack-tools PATCH 2/8] cache: Fix features array allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct cache::features is of type struct cache_feature **, allocate and
populate accordingly.

Fixes: ad31f852c3454 ("initial import of the conntrack daemon to Netfilter SVN")
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 src/cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cache.c b/src/cache.c
index 79a024f8b6bb0..9bc8d0f5bf34a 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -69,12 +69,12 @@ struct cache *cache_create(const char *name, enum cache_type type,
 
 	memcpy(c->feature_type, feature_type, sizeof(feature_type));
 
-	c->features = malloc(sizeof(struct cache_feature) * j);
+	c->features = malloc(sizeof(struct cache_feature *) * j);
 	if (!c->features) {
 		free(c);
 		return NULL;
 	}
-	memcpy(c->features, feature_array, sizeof(struct cache_feature) * j);
+	memcpy(c->features, feature_array, sizeof(struct cache_feature *) * j);
 	c->num_features = j;
 
 	c->extra_offset = size;
-- 
2.34.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux