diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-06-29 05:31:26 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-06-29 05:31:26 +0000 |
| commit | e12c2e18a5e6a2f936f0a2a6f777a21680e5a198 (patch) | |
| tree | 5b34fc5b3992a41ad6291fa5cb0c261c7d6b9328 /usr.bin | |
| parent | 88485b4a2fbfbfd17bd5e9896095c81f8a262c22 (diff) | |
Notes
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/csplit/csplit.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index 5513f7b83f61..dfc8f5bf0fd2 100644 --- a/usr.bin/csplit/csplit.c +++ b/usr.bin/csplit/csplit.c @@ -227,8 +227,11 @@ newfile(void) { FILE *fp; - snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix, (int)sufflen, - nfiles); + if (snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix, + (int)sufflen, nfiles) >= sizeof(currfile)) { + errno = ENAMETOOLONG; + err(1, NULL); + } if ((fp = fopen(currfile, "w+")) == NULL) err(1, "%s", currfile); nfiles++; |
