From d1647590ec4263592d6408cd4c16c2c2d55a7847 Mon Sep 17 00:00:00 2001
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Date: Thu, 28 May 2020 01:19:36 +0200
Subject: [PATCH] fk: fix wrong sizeof() in fk_constraint_def_sizeof()

The function returns a number of bytes needed to store
an fk_constraint_def object with its name and links.
However it used sizeof(struct fk_constraint) instead
of sizeof(struct fk_constraint_def) to calculate
base object size. This worked only because
fk_constraint is bigger than fk_constraint_def.
---
 src/box/fk_constraint.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/fk_constraint.h b/src/box/fk_constraint.h
index fee82afb0e..b1e0cfb843 100644
--- a/src/box/fk_constraint.h
+++ b/src/box/fk_constraint.h
@@ -131,7 +131,7 @@ struct fk_constraint {
 static inline size_t
 fk_constraint_def_sizeof(uint32_t link_count, uint32_t name_len)
 {
-	return sizeof(struct fk_constraint) +
+	return sizeof(struct fk_constraint_def) +
 		link_count * sizeof(struct field_link) +
 		name_len + 1;
 }
-- 
GitLab