In message <[email protected]> on Mon, 04 May 2009 12:46:40 +0100, Ben 
Laurie <[email protected]> said:

ben> Richard Levitte wrote:
ben> > In message <[email protected]> on Sun, 03 May 2009 20:13:20 
+0100, Ben Laurie <[email protected]> said:
ben> > 
ben> > ben> Richard Levitte wrote:
ben> > ben> >   OpenSSL CVS Repository
ben> > ben> >   http://cvs.openssl.org/
ben> > ben> >   
____________________________________________________________________________
ben> > ben> > 
ben> > ben> >   Server: cvs.openssl.org                  Name:   Richard Levitte
ben> > ben> >   Root:   /v/openssl/cvs                   Email:  
[email protected]
ben> > ben> >   Module: openssl                          Date:   26-Apr-2009 
14:16:08
ben> > ben> >   Branch: HEAD                             Handle: 
2009042613160800
ben> > ben> > 
ben> > ben> >   Modified files:
ben> > ben> >     openssl/apps            dgst.c
ben> > ben> > 
ben> > ben> >   Log:
ben> > ben> >     Cast to avoid signedness confusion
ben> > ben> 
ben> > ben> Wouldn't it be better to make len signed, if it actually is?
ben> > 
ben> > I agree, but it's passed by address to some function taking a size_t*,
ben> > which means there's gonna be a cast somewhere anyway.  I simply took
ben> > the easiest route.
ben> 
ben> Then one has to wonder why it is being tested for < 0.

Because it may get a negative value at one point.  You can have a look
for yourself, it can get its value in one of two ways:

1. Assigned through passed reference to EVP_DigestSignFinal(), which
   takes a size_t* as last argument.
2. Assigned the returned value from BIO_gets(), which may return a
   negative value and therefore returns a int.

len is the used further on in a call to BIO_write().

ben> > Really, we need to harmonize our uses of size_t, int, long and
ben> > so on...  It's a big job.
ben> 
ben> Yeah. I started on it once. It was a mess :-)

I know, did it as well...

Cheers,
Richard

-- 
Richard Levitte                         [email protected]
                                        http://richard.levitte.org/

"Life is a tremendous celebration - and I'm invited!"
-- from a friend's blog, translated from Swedish
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [email protected]

Reply via email to