Source-Changes-HG archive

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

[src/trunk]: src/crypto/external/bsd/netpgp/dist/src/lib netpgpkeys: properly...



details:   https://anonhg.NetBSD.org/src/rev/c36caeb4c9c3
branches:  trunk
changeset: 371259:c36caeb4c9c3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 01 22:21:31 2022 +0000

description:
netpgpkeys: properly terminate string before calling strdup

$ MALLOC_CONF=junk:true netpgpkeys \
    --export-key \
    --keyring=/usr/pkg/etc/gnupg/pkgsrc.gpg \
    b5952cabdd765a20

The above command printed "-----END PGP PUBLIC KEY BLOCK-----\r\n"
followed by "\xA5\xA5\xA5...".

diffstat:

 crypto/external/bsd/netpgp/dist/src/lib/keyring.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 255428eee184 -r c36caeb4c9c3 crypto/external/bsd/netpgp/dist/src/lib/keyring.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sat Oct 01 15:50:05 2022 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/keyring.c Sat Oct 01 22:21:31 2022 +0000
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.58 2022/08/27 08:58:32 rillig Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.59 2022/10/01 22:21:31 rillig Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -1159,6 +1159,7 @@
                pgp_write_xfer_seckey(output, keydata, passphrase,
                                        strlen((char *)passphrase), 1);
        }
+       pgp_memory_add(mem, "", 1);
        cp = netpgp_strdup(pgp_mem_data(mem));
        pgp_teardown_memory_write(output, mem);
        return cp;



Home | Main Index | Thread Index | Old Index