From 1d111465a7ef24ffefd59e5f6d326722b2a1a684 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 10 Apr 2023 14:58:11 -0400 Subject: [PATCH] I am a C programmer. I am better than you. --- citadel/utils/ctdl3264.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c index 60427af65..d4dfca401 100644 --- a/citadel/utils/ctdl3264.c +++ b/citadel/utils/ctdl3264.c @@ -151,6 +151,15 @@ void convert_msgmain(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT // If the msgnum is positive, we are looking at a MESSAGE else if (in_msgnum > 0) { + out_key->size = sizeof(long); + out_key->data = realloc(out_key->data, out_key->size); + out_msgnum = (long)in_msgnum; + memcpy(out_key->data, &out_msgnum, sizeof(long)); + + // copy the message verbatim + out_data->size = in_data->size; + out_data->data = realloc(out_data->data, out_data->size); + memcpy(out_data->data, in_data->data, out_data->size); } // If the msgnum is 0 it's probably not a valid record. -- 2.39.2