Print this page
10128 csplit should use strlcpy

*** 25,34 **** --- 25,38 ---- /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ /* + * Copyright (c) 2018, Joyent, Inc. + */ + + /* * csplit - Context or line file splitter * Compile: cc -O -s -o csplit csplit.c */ #include <stdio.h>
*** 389,399 **** } *delim = savedelim; } if ((opfil = fopen(file, "w")) == NULL) { ! (void) strcpy(tfile, file); (void) sprintf(fptr, "%.*d", fiwidth, (ctr-2)); fatal("Cannot create %s\n", tfile); } return (opfil); } --- 393,403 ---- } *delim = savedelim; } if ((opfil = fopen(file, "w")) == NULL) { ! (void) strlcpy(tfile, file, sizeof (tfile)); (void) sprintf(fptr, "%.*d", fiwidth, (ctr-2)); fatal("Cannot create %s\n", tfile); } return (opfil); }