[Announce] new gnupg snapshot
Werner Koch
wk at gnupg.org
Sat Apr 14 15:34:01 CEST 2001
On Sat, 14 Apr 2001, tftp wrote:
> Such assignments must be outlawed in first place. Rule #0 is that
> a procedure must tolerate incorrect parameters. But here we have
That function is declared static and therefore such a check is not
needed. Actually not checking here is a Good Thing because it
behaves like an assert and let us figure out the real problem, which
is somewhere else.
If you check for errors at all places, your program has to handle
much more possible error condition and this adds an incredible
amount of complexity and code - the worst thing is that you are not
able to check that error handling because it is not a real error but
a bug.
I agree that global functions should be tolerate against bad
parameters and especially in case of a library. For a normal
program an assert() is enough; a library should return an error
code.
Well, some things are of course a matter of personal coding style.
Here is the correct bug bix:
Index: getkey.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/getkey.c,v
retrieving revision 1.66.2.16
diff -u -r1.66.2.16 getkey.c
--- getkey.c 2001/04/05 12:21:43 1.66.2.16
+++ getkey.c 2001/04/14 11:54:04
@@ -1517,7 +1517,7 @@
for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) {
if ( k->pkt->pkttype == PKT_USER_ID
|| k->pkt->pkttype == PKT_PHOTO_ID ) {
- if ( uidnode )
+ if ( uidnode && signode )
fixup_uidnode ( uidnode, signode );
uidnode = k;
signode = NULL;
Ciao,
Werner
--
Werner Koch Omnis enim res, quae dando non deficit, dum habetur
g10 Code GmbH et non datur, nondum habetur, quomodo habenda est.
Privacy Solutions -- Augustinus
More information about the Gnupg-devel
mailing list