Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Michael C. Adler
Wed, 29 Jul 1992 20:00
tar 1.10 bug
Author: Michael C. Adler
Date: Wed, 29 Jul 1992 20:00
Date: Wed, 29 Jul 1992 20:00
88 lines
3131 bytes
3131 bytes
The following diff file for create.c in tar 1.10 fixes two bugs:
1. Off by 1 error in deciding whether another extended header is needed
when creating a sparse file caused the last sparse table entry not
to be emitted.
2. Long link pathnames were read into too short a buffer causing overwrite.
*** create.c.orig Mon Jul 1 14:20:22 1991
--- create.c Wed Jul 29 15:38:31 1992
***************
*** 26,31 ****
--- 26,32 ----
*/
#include <sys/types.h>
#include <sys/stat.h>
+ #include <errno.h>
#include <stdio.h>
#ifndef V7
***************
*** 513,519 ****
/* sum += i;
if (sum < upperbound)
goto extend;*/
! if (index_offset+i < upperbound) {
index_offset += i;
exhdr->ext_hdr.isextended++;
goto extend;
--- 514,520 ----
/* sum += i;
if (sum < upperbound)
goto extend;*/
! if (index_offset+i <= upperbound) {
index_offset += i;
exhdr->ext_hdr.isextended++;
goto extend;
***************
*** 592,613 ****
case S_IFLNK: /* Symbolic link */
{
int size;
hstat.st_size = 0; /* Force 0 size on symlink */
header = start_header(p, &hstat);
if (header == NULL) goto badfile;
! size = readlink(p, header->header.linkname, NAMSIZ);
if (size < 0) goto badperror;
! if (size == NAMSIZ) {
! char buf[MAXPATHLEN];
- readlink(p,buf,MAXPATHLEN);
/* next_mangle(header->header.linkname); */
add_symlink_mangle(buf,p,header->header.linkname);
msg("symbolic link %s too long: mangling to
%s",p, header->header.linkname);
/* size=strlen(header->header.linkname); */
! } else
! header->header.linkname[size] = '\0';
header->header.linkflag = LF_SYMLINK;
finish_header(header); /* Nothing more to do to it */
}
--- 593,615 ----
case S_IFLNK: /* Symbolic link */
{
int size;
+ char buf[MAXPATHLEN+1];
hstat.st_size = 0; /* Force 0 size on symlink */
header = start_header(p, &hstat);
if (header == NULL) goto badfile;
! size = readlink(p, buf, MAXPATHLEN);
if (size < 0) goto badperror;
! buf[size] = '\0';
! if (size >= NAMSIZ) {
/* next_mangle(header->header.linkname); */
add_symlink_mangle(buf,p,header->header.linkname);
msg("symbolic link %s too long: mangling to
%s",p, header->header.linkname);
/* size=strlen(header->header.linkname); */
! } else {
! strncpy(header->header.linkname,buf,NAMSIZ);
! }
header->header.linkflag = LF_SYMLINK;
finish_header(header); /* Nothing more to do to it */
}
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads