| 1 |
/** $MirOS: src/bin/pax/tar.c,v 1.3 2006/06/23 23:03:57 tg Exp $ */ |
/** $MirOS: src/bin/pax/tar.c,v 1.4 2007/02/17 04:52:41 tg Exp $ */ |
| 2 |
/* $OpenBSD: tar.c,v 1.41 2006/03/04 20:24:55 otto Exp $ */ |
/* $OpenBSD: tar.c,v 1.41 2006/03/04 20:24:55 otto Exp $ */ |
| 3 |
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ |
/* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ |
| 4 |
|
|
| 36 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
| 37 |
*/ |
*/ |
| 38 |
|
|
| 39 |
#ifndef lint |
#include <sys/param.h> |
|
#if 0 |
|
|
static const char sccsid[] = "@(#)tar.c 8.2 (Berkeley) 4/18/94"; |
|
|
#else |
|
|
static const char rcsid[] = "$OpenBSD: tar.c,v 1.41 2006/03/04 20:24:55 otto Exp $"; |
|
|
#endif |
|
|
#endif /* not lint */ |
|
|
|
|
|
#include <sys/types.h> |
|
| 40 |
#include <sys/time.h> |
#include <sys/time.h> |
| 41 |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
#include <sys/param.h> |
|
| 42 |
#include <string.h> |
#include <string.h> |
| 43 |
#include <stdio.h> |
#include <stdio.h> |
| 44 |
#include <unistd.h> |
#include <unistd.h> |
| 48 |
#include "tar.h" |
#include "tar.h" |
| 49 |
#include "options.h" |
#include "options.h" |
| 50 |
|
|
| 51 |
|
__SCCSID("@(#)tar.c 8.2 (Berkeley) 4/18/94"); |
| 52 |
|
__RCSID("$MirOS: src/bin/pax/tar.c,v 1.4 2007/02/17 04:52:41 tg Exp $"); |
| 53 |
|
|
| 54 |
/* |
/* |
| 55 |
* Routines for reading, writing and header identify of various versions of tar |
* Routines for reading, writing and header identify of various versions of tar |
| 56 |
*/ |
*/ |
| 116 |
*/ |
*/ |
| 117 |
|
|
| 118 |
int |
int |
| 119 |
tar_trail(ARCHD *ignore, char *buf, int in_resync, int *cnt) |
tar_trail(ARCHD *ignore __attribute__((unused)), char *buf, int in_resync, |
| 120 |
|
int *cnt) |
| 121 |
{ |
{ |
| 122 |
int i; |
int i; |
| 123 |
|
|
| 552 |
case PAX_SLK: |
case PAX_SLK: |
| 553 |
case PAX_HLK: |
case PAX_HLK: |
| 554 |
case PAX_HRG: |
case PAX_HRG: |
| 555 |
if (arcn->ln_nlen > sizeof(hd->linkname)) { |
if ((size_t)arcn->ln_nlen > sizeof(hd->linkname)) { |
| 556 |
paxwarn(1, "Link name too long for tar %s", |
paxwarn(1, "Link name too long for tar %s", |
| 557 |
arcn->ln_name); |
arcn->ln_name); |
| 558 |
return(1); |
return(1); |
| 570 |
len = arcn->nlen; |
len = arcn->nlen; |
| 571 |
if (arcn->type == PAX_DIR) |
if (arcn->type == PAX_DIR) |
| 572 |
++len; |
++len; |
| 573 |
if (len > sizeof(hd->name)) { |
if ((size_t)len > sizeof(hd->name)) { |
| 574 |
paxwarn(1, "File name too long for tar %s", arcn->name); |
paxwarn(1, "File name too long for tar %s", arcn->name); |
| 575 |
return(1); |
return(1); |
| 576 |
} |
} |
| 930 |
* check the length of the linkname |
* check the length of the linkname |
| 931 |
*/ |
*/ |
| 932 |
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) || |
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) || |
| 933 |
(arcn->type == PAX_HRG)) && (arcn->ln_nlen > sizeof(hd->linkname))){ |
(arcn->type == PAX_HRG)) && |
| 934 |
|
((size_t)arcn->ln_nlen > sizeof(hd->linkname))) { |
| 935 |
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name); |
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name); |
| 936 |
return(1); |
return(1); |
| 937 |
} |
} |