From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> Now that there are size functions for traceeval_insert() and traceveal_query(), add checks to make sure that the size being passed in is actually the size expected. Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- src/histograms.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/histograms.c b/src/histograms.c index 5e2e9200cbf6..973bf3ad279c 100644 --- a/src/histograms.c +++ b/src/histograms.c @@ -684,6 +684,9 @@ int traceeval_query_size(struct traceeval *teval, const struct traceeval_data *k if (!teval || !keys || !results) return -1; + if (nr_keys != teval->nr_key_types) + return -1; + /* find key and copy its corresponding value pair */ if ((check = get_entry(teval, keys, &entry)) < 1) return check; @@ -936,6 +939,9 @@ int traceeval_insert_size(struct traceeval *teval, int check; int i; + if (nr_keys != teval->nr_key_types || nr_vals != teval->nr_val_types) + return -1; + entry = NULL; check = get_entry(teval, keys, &entry); -- 2.40.1