From: Stelian Pop Date: Fri, 10 Dec 2004 13:31:20 +0000 (+0000) Subject: Fix a problem in restore where the final \0 in the symbolic X-Git-Tag: release_0_4b38~6 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=47acd076f971d347c39c498e69634a3aa0f73031;p=dump.git Fix a problem in restore where the final \0 in the symbolic link names could have been lost, generating corrupt filenames. --- diff --git a/CHANGES b/CHANGES index 5ae2f0a..726d0ee 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.259 2004/11/22 10:32:31 stelian Exp $ +$Id: CHANGES,v 1.260 2004/12/10 13:31:20 stelian Exp $ Changes between versions 0.4b37 and 0.4b38 (released ????????????) ================================================================== @@ -22,6 +22,11 @@ Changes between versions 0.4b37 and 0.4b38 (released ????????????) Thanks to Kevin B. Haines for submitting the bug and testing the fix. +6. Fix a problem in restore where the final \0 in the symbolic + link names could have been lost, generating corrupt filenames. + Thanks to Kyle Wilson for reporting the + bug. + Changes between versions 0.4b36 and 0.4b37 (released July 7, 2004) ================================================================== diff --git a/THANKS b/THANKS index 98a98e3..d1a6558 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ -$Id: THANKS,v 1.87 2004/11/22 10:32:31 stelian Exp $ +$Id: THANKS,v 1.88 2004/12/10 13:31:20 stelian Exp $ Dump and restore were written by the people of the CSRG at the University of California, Berkeley. @@ -129,6 +129,7 @@ Daniel Veillard Daniel.Veillard@imag.fr Jason Venner jason@idiom.com John I Wang jiwang@users.sourceforge.net Christian Weisgerber naddy@mips.rhein-neckar.de +Kyle Wilson kyle.wilson@amd.com Kim Yong-jun loveyou@hackerslab.org John Yu jky@it.bu.edu Ian Zimmerman itz@speakeasy.org diff --git a/restore/tape.c b/restore/tape.c index 2980764..b383866 100644 --- a/restore/tape.c +++ b/restore/tape.c @@ -42,7 +42,7 @@ #ifndef lint static const char rcsid[] = - "$Id: tape.c,v 1.82 2004/08/16 09:39:47 stelian Exp $"; + "$Id: tape.c,v 1.83 2004/12/10 13:31:21 stelian Exp $"; #endif /* not lint */ #include @@ -1317,10 +1317,13 @@ xtrlnkfile(char *buf, size_t size) { pathlen += size; - if (pathlen > MAXPATHLEN) + if (pathlen > MAXPATHLEN) { + buf[size - 1] = '\0'; errx(1, "symbolic link name: %s->%s%s; too long %d", curfile.name, lnkbuf, buf, pathlen); + } (void) strcat(lnkbuf, buf); + lnkbuf[pathlen] = '\0'; } /*