Re: Segmentation fault while restoring

Miek Gieben <[email protected]> Sun, 18 May 2003 19:30:15 +0200
Newsgroups gmane.comp.sysutils.backup.hdup.devel
Message-ID <[email protected]>
[On 18 May, @16:03, Frank wrote in "[hdup-dev] Segmentation fault  ..."]
> Hi!
> 
> Sometimes I get a segmenatation fault while restoring a backup.
> 
> The debugger told me, it happens in hduplib.c:851
>   globfree(&globbuf);
> 
> I found the reason in the source hduprestore.c:135
>   archivename = (char*) malloc(strlen(directory) + h + 12 + 8 + 15 +40);
> 
> At this point the content of directory is random.
> Because of that the result of "strlen(directory)" can
> be 0 as good as a very big value.
> 
> The easiest solution is:
>   archivename = (char*) malloc((p + h + 11 + 5) + h + 12 + 8 + 15 +40);
> The same problem appears in line 137 with matchname.

thanks! you're absolutely right. Your fix is in the CVS.

grtz Miek