Segmentation fault while restoring

Frank Behrendt <[email protected]> 18 May 2003 16:03:16 +0200
Newsgroups gmane.comp.sysutils.backup.hdup.devel
Message-ID <[email protected]>
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 =3D (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 =3D (char*) malloc((p + h + 11 + 5) + h + 12 + 8 + 15 +40);
The same problem appears in line 137 with matchname.

Greetings from Osnabr=C3=BCck,
  Frank Behrendt