On Mon, 2014-08-25 at 11:15 +0200, Svante Signell wrote:
> found 754792 20140105-1
> thanks
> 
> On Thu, 2014-08-21 at 21:36 +0200, Pierre Chifflier wrote:
> > On Mon, Jul 14, 2014 at 01:15:26PM +0200, Svante Signell wrote:
> > > Source: libbfio
> > > Version: 20130507-1
> > > Severity: important
> > > Tags: patch
> > > User: debian-h...@lists.debian.org
> > > Usertags: hurd

> > Hi Svante,
> > 
> > I just uploaded new upstream versions for libbfio and libewf.
> > 

Attached is an updated patch, the previous one had a spurious newline
added. This patch is the same as for libewf in #754816 (just different
name and main directory name), to be updated too.

Index: libbfio-20140105/libcpath/libcpath_path.c
===================================================================
--- libbfio-20140105.orig/libcpath/libcpath_path.c
+++ libbfio-20140105/libcpath/libcpath_path.c
@@ -338,40 +338,12 @@ int libcpath_path_get_current_working_di
 
 		return( -1 );
 	}
-	*current_working_directory_size = (size_t) PATH_MAX;
-
-	*current_working_directory = libcstring_narrow_string_allocate(
-	                              *current_working_directory_size );
 
+	*current_working_directory = getcwd(
+					    NULL,
+					    0 );
 	if( *current_working_directory == NULL )
 	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( memory_set(
-	     *current_working_directory,
-	     0,
-	     sizeof( char ) * *current_working_directory_size ) == NULL )
-	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
-		 "%s: unable to clear current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     *current_working_directory,
-	     *current_working_directory_size ) == NULL )
-	{
 		libcerror_system_set_error(
 		 error,
 		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
@@ -382,6 +354,8 @@ int libcpath_path_get_current_working_di
 
 		goto on_error;
 	}
+	*current_working_directory_size = 1 + libcstring_narrow_string_length(
+									      *current_working_directory );
 	return( 1 );
 
 on_error:
@@ -3036,23 +3010,10 @@ int libcpath_path_get_current_working_di
 
 		return( -1 );
 	}
-	narrow_current_working_directory = libcstring_narrow_string_allocate(
-	                                    PATH_MAX );
-
-	if( narrow_current_working_directory == NULL )
-	{
-		libcerror_error_set(
-		 error,
-		 LIBCERROR_ERROR_DOMAIN_MEMORY,
-		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
-		 "%s: unable to create narrow current working directory.",
-		 function );
-
-		goto on_error;
-	}
-	if( getcwd(
-	     narrow_current_working_directory,
-	     PATH_MAX ) == NULL )
+	narrow_current_working_directory = getcwd(
+						  NULL,
+						  0 );
+	if( narrow_current_working_directory == NULL)
 	{
 		libcerror_system_set_error(
 		 error,

Reply via email to