diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-07-21 22:56:59 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-07-21 22:56:59 +0000 |
commit | f179b9898d07f51cd6a5261fad5e384741243bf6 (patch) | |
tree | ad3d7a3891beaf30b1e0e99ff78488ce49a61bf0 /bin | |
parent | d49b4aa12642572bc0cedb32730dcbcd537e3120 (diff) |
Prevent segfault when "cpio -o" is called with no input.
Found and fix provided by Alf Schlichting <a dot schlichting at
lemarit dot com>.
OK millert@ and markus@.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pax/ar_subs.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bin/pax/ar_subs.c b/bin/pax/ar_subs.c index 11226280e4d..dcd2a99132a 100644 --- a/bin/pax/ar_subs.c +++ b/bin/pax/ar_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $ */ +/* $OpenBSD: ar_subs.c,v 1.30 2006/07/21 22:56:58 ray Exp $ */ /* $NetBSD: ar_subs.c,v 1.5 1995/03/21 09:07:06 cgd Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)ar_subs.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.29 2006/01/25 17:42:08 markus Exp $"; +static const char rcsid[] = "$OpenBSD: ar_subs.c,v 1.30 2006/07/21 22:56:58 ray Exp $"; #endif #endif /* not lint */ @@ -408,9 +408,10 @@ wr_archive(ARCHD *arcn, int is_app) if (ftree_start() < 0) { if (is_app) goto trailer; - if (((*frmt->st_wr)() < 0)) - return; - } + return; + } else if (((*frmt->st_wr)() < 0)) + return; + wrf = frmt->wr; /* |