BUG: Fix extract. Looks like dirname actually changes the string, so temporary string should be used

This commit is contained in:
Andy Cedilnik 2005-12-29 10:41:34 -05:00
parent cef4806c88
commit 21c7454250
1 changed files with 7 additions and 1 deletions

View File

@ -213,8 +213,14 @@ tar_extract_regfile(TAR *t, char *realname)
uid = th_get_uid(t);
gid = th_get_gid(t);
if (mkdirhier(dirname(filename)) == -1)
strncpy(buf, filename, sizeof(buf)-1);
buf[sizeof(buf)-1] = 0;
if (mkdirhier(dirname(buf)) == -1)
{
return -1;
}
#ifdef DEBUG
printf(" ==> extracting: %s (mode %04o, uid %d, gid %d, %d bytes)\n",