Source-Changes-D archive

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

Re: CVS commit: [agc-netpgp-standalone] src/crypto/external/bsd/netpgp/dist/src



On Fri, Oct 26, 2012 at 07:28:15AM +0100, David Laight wrote:
> On Fri, Oct 26, 2012 at 05:03:24AM +0200, Alistair Crooks wrote:
> > 
> > /* set up the pubkey keyring */
> > int
> > pgpv_read_pubring(pgpv_t *pgp, const void *keyring, ssize_t size)
> > {
> >         if (keyring) { 
> >                 return (size > 0) ?
> >                         read_binary_memory(pgp, "pubring", keyring, 
> > (size_t)size) :
> >                         read_binary_file(pgp, "pubring", "%s", keyring);
> >         }  
> >         return read_binary_file(pgp, "pubring", "%s/%s", getenv("HOME"), 
> > ".gnupg/pubring.gpg");
> > }
> 
> What happens if $HOME is undefined ?

If $HOME is undefined, then the default public keyring will not be
found.  If the default public keyring is not found, then the
verification will fail.

> What happens if $HOME is very long ?

If $HOME is very long, then the snprintf will truncate the MAXPATHLEN
buffer further down the call tree.  If the buffer is truncated, the
correct default public keyring will not be found.  If the default
public keyring is not found, the verification will fail.
 
> Why did someone use ?: not if ?

Maybe because it's neater, it's someone's natural coding style, it's
much more obvious what's happening, it doesn't lead to staircases, and
I can't believe I'm even typing this.

Regards,
Alistair


Home | Main Index | Thread Index | Old Index