[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Issue #2154 - svn blame to error out gracefully given a directory

From: <kfogel_at_collab.net>
Date: 2005-02-23 17:09:20 CET

VK Sameer <sameer@collab.net> writes:
> As currently implemented for this issue, message and serr->message are
> both NULL (and in fact message = serr->message). There is no check for
> NULL before calling apr_pstrdup(). Is this a problem?

httpd-2.0/srclib/apr/include/apr_strings.h doesn't seem to say:

   /**
    * duplicate a string into memory allocated out of a pool
    * @param p The pool to allocate out of
    * @param s The string to duplicate
    * @return The new string
    */
   APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
   
httpd-2.0/srclib/apr/strings/apr_strings.c, however, does:

   APR_DECLARE(char *) apr_pstrdup(apr_pool_t *a, const char *s)
   {
       char *res;
       apr_size_t len;
   
       if (s == NULL) {
           return NULL;
       }
       len = strlen(s) + 1;
       res = apr_palloc(a, len);
       memcpy(res, s, len);
       return res;
   }

I still think it's a bug that we don't check serr->message in our
code, however, and rely on this undocumented behavior of apr_pstrdup.
My sense is that our code "thinks" serr->message is non-null, and that
this might get us into trouble down the road in 'derr' or some other
place.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 23 17:26:34 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.