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

[BUG?] svn_path_join_many doesn't check for NULL

From: Ph. Marek <philipp.marek_at_bmlv.gv.at>
Date: 2004-12-23 08:24:19 CET

Hello everybody,

in svn-1.1.2 I see the following statement
(subversion/libsvn_subr/path.c:218):
 path = p = apr_palloc (pool, total_len + 1);

I believe it is possible (if unlikely) to receive a NULL value here (if memory
is full).

But the return value is not checked for NULL!
The trivial patch below moves the same problem a bit downwards to the callers;
they'd have to be done too.

Regards,

Phil

diff subversion/libsvn_subr/path.c.orig subversion/libsvn_subr/path.c
--- subversion/libsvn_subr/path.c.orig 2004-12-07 18:35:27.000000000 +0100
+++ subversion/libsvn_subr/path.c 2004-12-23 08:22:08.000000000 +0100
@@ -216,6 +216,7 @@

   /* we got the total size. allocate it, with room for a NULL character. */
   path = p = apr_palloc (pool, total_len + 1);
+ if (!path) return NULL;

   /* if we aren't supposed to skip forward to an absolute component, and if
      this is not an empty base that we are skipping, then copy the base

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Dec 23 08:25:56 2004

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.