You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Dirk Hoffmann <dh...@web.de> on 2004/10/12 14:09:55 UTC

Danger of dereferencing null pointer

Hi,

when I was looking at subversion/clients/cmdline/util.c to comprehend 
commit items I found the following lines of code:

  if (! (commit_items || commit_items->nelts))
    {
      *log_msg = "";
      return SVN_NO_ERROR;
    }

I believe the first line should be

if (!commit_items || !commit_items->nelts)

or

if (! (commit_items && commit_items->nelts) )

Otherwise if commit_item is NULL it will be dereferenced.

Regards Dirk





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Danger of dereferencing null pointer

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2004-10-12 at 10:09, Dirk Hoffmann wrote:
> when I was looking at subversion/clients/cmdline/util.c to comprehend 
> commit items I found the following lines of code:

>   if (! (commit_items || commit_items->nelts))

You're right that this is bogus; however, it's also bogus because
commit_items can never be NULL (the contract for
svn_client_get_commit_log_t does not specify that commit_items may be
NULL, nor does libsvn_client ever pass a NULL commit_items argument). 
So the test never succeeds.  I'll fix.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org