diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-03-07 20:54:31 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-03-14 11:23:59 +0100 |
| commit | 044da08973957b32703fe338eb95c5171ce471ba (patch) | |
| tree | fe1b0ce72e4421095deaa555fdaa9de62d664d0e /src/lib/protobuf.c | |
| parent | 4b76e15279792331f886cf756b825fb1e7a1c9ba (diff) | |
| download | ouroboros-044da08973957b32703fe338eb95c5171ce471ba.tar.gz ouroboros-044da08973957b32703fe338eb95c5171ce471ba.zip | |
lib: Fix certificate DER encoding and key buffers
i2d_X509() allocated buf->data via OPENSSL_malloc(), but callers free
it with freebuf() which uses free(). Fix by allocating with malloc()
and encoding directly into the buffer. Also replaces MSGBUFSZ with
CRYPT_KEY_BUFSZ (4096) for key material buffers and removes leftover
debug logging.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib/protobuf.c')
| -rw-r--r-- | src/lib/protobuf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/protobuf.c b/src/lib/protobuf.c index 77f06032..28b3aab2 100644 --- a/src/lib/protobuf.c +++ b/src/lib/protobuf.c @@ -161,6 +161,8 @@ struct name_info name_info_msg_to_s(const name_info_msg_t * msg) assert(msg != NULL); assert(strlen(msg->name) <= NAME_SIZE); + memset(&s, 0, sizeof(s)); + strcpy(s.name, msg->name); strcpy(s.s.key, msg->skey); strcpy(s.s.crt, msg->scrt); |
