split.c (92922) | split.c (97332) |
---|---|
1/* 2 * Copyright (c) 1987, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1987, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/usr.bin/split/split.c 92922 2002-03-22 01:42:45Z imp $"); | 35__FBSDID("$FreeBSD: head/usr.bin/split/split.c 97332 2002-05-27 04:59:46Z tjr $"); |
36 37#ifndef lint 38static const char copyright[] = 39"@(#) Copyright (c) 1987, 1993, 1994\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif 42 43#ifndef lint --- 98 unchanged lines hidden (view full) --- 142 143 if (*argv != NULL) 144 if (ifd == -1) { /* Input file. */ 145 if ((ifd = open(*argv, O_RDONLY, 0)) < 0) 146 err(EX_NOINPUT, "%s", *argv); 147 ++argv; 148 } 149 if (*argv != NULL) /* File name prefix. */ | 36 37#ifndef lint 38static const char copyright[] = 39"@(#) Copyright (c) 1987, 1993, 1994\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif 42 43#ifndef lint --- 98 unchanged lines hidden (view full) --- 142 143 if (*argv != NULL) 144 if (ifd == -1) { /* Input file. */ 145 if ((ifd = open(*argv, O_RDONLY, 0)) < 0) 146 err(EX_NOINPUT, "%s", *argv); 147 ++argv; 148 } 149 if (*argv != NULL) /* File name prefix. */ |
150 (void)strcpy(fname, *argv++); | 150 if (strlcpy(fname, *argv++, sizeof(fname)) >= sizeof(fname)) 151 errx(EX_USAGE, "file name prefix is too long"); |
151 if (*argv != NULL) 152 usage(); 153 154 if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname)) 155 errx(EX_USAGE, "suffix is too long"); 156 if (pflag && (numlines != 0 || bytecnt != 0)) 157 usage(); 158 --- 182 unchanged lines hidden --- | 152 if (*argv != NULL) 153 usage(); 154 155 if (strlen(fname) + (unsigned long)sufflen >= sizeof(fname)) 156 errx(EX_USAGE, "suffix is too long"); 157 if (pflag && (numlines != 0 || bytecnt != 0)) 158 usage(); 159 --- 182 unchanged lines hidden --- |