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 Protect against NULL...
details: https://anonhg.NetBSD.org/src/rev/d304997d5b12
branches: trunk
changeset: 755042:d304997d5b12
user: agc <agc%NetBSD.org@localhost>
date: Fri May 21 06:53:51 2010 +0000
description:
Protect against NULL pointers in key output in a different way - only
advance its counter if it's non-NULL.
Regression test for this is:
netpgpkeys --list-key '\.de\>'
with my standard keyring (to list all keys which have at least one subuid
with a German email address).
diffstat:
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (36 lines):
diff -r 4d8842151723 -r d304997d5b12 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri May 21 06:37:26 2010 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri May 21 06:53:51 2010 +0000
@@ -34,7 +34,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.54 2010/05/20 14:43:42 agc Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.55 2010/05/21 06:53:51 agc Exp $");
#endif
#include <sys/types.h>
@@ -600,7 +600,9 @@
"pub",
&key->key.pubkey, psigs);
}
- pubs.c += 1;
+ if (pubs.v[pubs.c] != NULL) {
+ pubs.c += 1;
+ }
k += 1;
}
} while (key != NULL);
@@ -611,10 +613,8 @@
(pubs.c == 1) ? "" : "s");
}
for (k = 0 ; k < pubs.c ; k++) {
- if (pubs.v[k]) {
- (void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : "");
- free(pubs.v[k]);
- }
+ (void) fprintf(fp, "%s%s", pubs.v[k], (k < pubs.c - 1) ? "\n" : "");
+ free(pubs.v[k]);
}
free(pubs.v);
return pubs.c;
Home |
Main Index |
Thread Index |
Old Index