NetBSD Problem Report #29290

From www@netbsd.org  Tue Feb  8 15:46:28 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 5378963B844; Tue,  8 Feb 2005 15:46:28 +0000 (UTC)
Message-Id: <20050208154628.5378963B844@narn.netbsd.org>
Date: Tue,  8 Feb 2005 15:46:28 +0000 (UTC)
From: tnozaki@NetBSD.org
Reply-To: tnozaki@NetBSD.org
To: gnats-bugs@netbsd.org
Subject: cpio with `--foo' unknown long option cause SIGSEGV
X-Send-Pr-Version: www-1.0

>Number:         29290
>Category:       bin
>Synopsis:       cpio with `--foo' unknown long option cause SIGSEGV
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 08 15:47:01 +0000 2005
>Closed-Date:    Thu Feb 10 17:48:47 +0000 2005
>Last-Modified:  Thu Dec 01 03:01:23 +0000 2005
>Originator:     Takehiko NOZAKI
>Release:        2.99.15
>Organization:
>Environment:
NetBSD fly.example.jp 2.99.15 NetBSD 2.99.15 (FLY) #0: Sun Feb  6 18:11:25 JST 2005  tnozaki AT fly.example.jp:/usr/src/sys/arch/i386/compile/FLY i386
>Description:
cpio with `--foo' unknown long option cause SIGSEGV.
see fix section.
>How-To-Repeat:
run
$ cpio --foo

>Fix:
Index: options.c
===================================================================
RCS file: /home/cvs/NetBSD/src/bin/pax/options.c,v
retrieving revision 1.82
diff -u -r1.82 options.c
--- options.c	26 Oct 2004 16:11:49 -0000	1.82
+++ options.c	8 Feb 2005 15:18:34 -0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.81 2004/10/22 21:00:18 jmc Exp $	*/
+/*	$NetBSD: options.c,v 1.82 2004/10/26 16:11:49 tron Exp $	*/

 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: options.c,v 1.81 2004/10/22 21:00:18 jmc Exp $");
+__RCSID("$NetBSD: options.c,v 1.82 2004/10/26 16:11:49 tron Exp $");
 #endif
 #endif /* not lint */

@@ -1378,6 +1378,7 @@
 	{ "version",		no_argument,		0,
 						OPT_VERSION },
 #endif
+	{ 0,			0,			0,	0 },
 };

 /*

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: jmc@netbsd.org
State-Changed-When: Thu, 10 Feb 2005 17:48:47 +0000
State-Changed-Why:
Committed fixes


From: James Chacon <jmc@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29290 CVS commit: src/bin/pax
Date: Thu, 10 Feb 2005 17:48:34 +0000 (UTC)

 Module Name:	src
 Committed By:	jmc
 Date:		Thu Feb 10 17:48:34 UTC 2005

 Modified Files:
 	src/bin/pax: options.c

 Log Message:
 Fix from PR#29290. Properly terminate the cpio_longopts struct so an unknown
 option doesn't run off the end and core dump


 To generate a diff of this commit:
 cvs rdiff -r1.82 -r1.83 src/bin/pax/options.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29290 CVS commit: [netbsd-2] src/bin/pax
Date: Sun, 29 May 2005 23:18:53 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Sun May 29 23:18:53 UTC 2005

 Modified Files:
 	src/bin/pax [netbsd-2]: options.c

 Log Message:
 Pull up revision 1.83 (requested by kleink in ticket #1554):
 Fix from PR#29290. Properly terminate the cpio_longopts struct so an unknown
 option doesn't run off the end and core dump


 To generate a diff of this commit:
 cvs rdiff -r1.73.2.1.2.1 -r1.73.2.1.2.2 src/bin/pax/options.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Min Sik Kim <minskim@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29290 CVS commit: pkgsrc/archivers/pax
Date: Thu,  1 Dec 2005 03:00:01 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	minskim
 Date:		Thu Dec  1 03:00:01 UTC 2005

 Modified Files:
 	pkgsrc/archivers/pax: Makefile
 	pkgsrc/archivers/pax/files: Makefile.in ar_io.c ar_subs.c buf_subs.c
 	    config.h.in configure configure.ac cpio.1 cpio.c extern.h
 	    file_subs.c ftree.c getoldopt.c options.c pat_rep.c pax.1 pax.c
 	    pax.h tables.c tables.h tar.1 tar.c tty_subs.c

 Log Message:
 Update pax to 20051108.  The previous version failed to handle the -X
 option, which is used in print/teTeX3-texmf.  The only difference from
 the pax in src is that tar does not support the --chroot option if
 fchroot(2) is not available.

 Major changes and bug fixes since 20040802:

 PR/18759: FUKAUMI Naoki: pax/tar dot-dot handling broken
 PR/18840: Frederick Bruckman:  Fix for PR/18663 incomplete pax symlink handling
 This patch makes ``--insecure'' do something. Now if ``--insecure''
 is not set (the default) we do a realpath(3) in all the pathnames
 that we are trying to create and if either realpath fails, or the
 path is outside our working directory, we print a warning and die.
 This maybe too strict and might fail on valid archives that create
 symlinks and directories in the wrong order.

 PR/31923: Sergey Svishchev: pax-as-tar ignores -k, overwrites existing files
 Fix from Onno van der Linden

 PR/30132: Juan RP: tar --chroot refuses to extract files.
 fchroot() changes the effective path, so we need to call updatepath().

 Apply user supplied patterns first before applying actions for -A. This way pax
 behavior WRT to patterns lines up with the example in the documentation
 and how other implementations do it as well since -A is a non-standard
 option/behavior. Fixes items noted in PR#23776

 Add an option --chroot to tar.  Causes it to chroot(".") before doing
 an extract.  With -h this will cause existing absolute symlinks to be treated
 as relative to the current directory.
 Helps sysinst handle existing symlinks in the target system.
 Remove 'L' from the usage (got spilt into 'h' and 'H' many moons ago)
 Add 'S' to usage, and put into correct place in options list.

 PR/27213: Greg A. Woods: pax doesn't honour SIGPIPE when listing
 But always exit, not just on SIGPIPE.

 Properly handle "cpio" archives where the last hardlink includes the
 data of a file. This fixes PR bin/26514.

 PR/20228: Simon Burge: pax has problems reading a particular cpio archive
 The problem here is that the archive is too short (< 512 bytes). The
 buffer routines, try to read at least 512 bytes, even when we try to determine
 what format file we have, which is wrong.

 Don't leave arcn->org_name pointing to ftent->fts_path, if we being cpio
 then ftent is freed just below.  Take a copy of the name and point org_name
 at the copy.
 Should fix PR/30627 (the fix in the PR will break pax and tar!)

 PR/30167: J.T. Conklin: NetBSD tar does not support GNU tar --no-recursion flag

 Fix from PR#29290. Properly terminate the cpio_longopts struct so an unknown
 option doesn't run off the end and core dump

 Fix broken cpio(1) option handling:
 - "cpio -i -t" should list the contents of a file, not extract it.
 - Don't extract a file when only option "-d" is given.
 Patch supplied by Paul Ripke in PR bin/26513.

 PR/27212: Greg A. Woods: Accept "-C <dirname>" inside filelists in addition
 to "-C\n<dirname>".
 But we are not making it the default output option as the patch suggests.

 PR/19490: Julio Merino: Teach tar about --sparse, -S option.
 Do it for cpio too.

 PR/27208: Greg A. Woods: pax must call options() before using syswarn()
 or tty_warn()

 PR/20071: Perry Metzger: --extract handling is broken. This patch fixes
 Perry's example.


 To generate a diff of this commit:
 cvs rdiff -r1.20 -r1.21 pkgsrc/archivers/pax/Makefile
 cvs rdiff -r1.8 -r1.9 pkgsrc/archivers/pax/files/Makefile.in \
     pkgsrc/archivers/pax/files/ar_io.c pkgsrc/archivers/pax/files/ftree.c \
     pkgsrc/archivers/pax/files/pax.h
 cvs rdiff -r1.7 -r1.8 pkgsrc/archivers/pax/files/ar_subs.c \
     pkgsrc/archivers/pax/files/options.c pkgsrc/archivers/pax/files/pax.c
 cvs rdiff -r1.5 -r1.6 pkgsrc/archivers/pax/files/buf_subs.c \
     pkgsrc/archivers/pax/files/extern.h \
     pkgsrc/archivers/pax/files/getoldopt.c \
     pkgsrc/archivers/pax/files/tables.c
 cvs rdiff -r1.10 -r1.11 pkgsrc/archivers/pax/files/config.h.in \
     pkgsrc/archivers/pax/files/file_subs.c
 cvs rdiff -r1.13 -r1.14 pkgsrc/archivers/pax/files/configure \
     pkgsrc/archivers/pax/files/configure.ac
 cvs rdiff -r1.2 -r1.3 pkgsrc/archivers/pax/files/cpio.1
 cvs rdiff -r1.4 -r1.5 pkgsrc/archivers/pax/files/cpio.c \
     pkgsrc/archivers/pax/files/pat_rep.c pkgsrc/archivers/pax/files/pax.1 \
     pkgsrc/archivers/pax/files/tar.1 pkgsrc/archivers/pax/files/tty_subs.c
 cvs rdiff -r1.3 -r1.4 pkgsrc/archivers/pax/files/tables.h
 cvs rdiff -r1.9 -r1.10 pkgsrc/archivers/pax/files/tar.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.