| Summary: | [PATCH] fixes to jot(1) from OpenBSD | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | dd <dd> | ||||
| Component: | bin | Assignee: | dd <dd> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
> The attached patch fixes some overflows in jot(1) and syncs up to > OpenBSD a little. Significant changes include: > > - use getopt > - de-register > - fix overflows in -b and -w options; old behavior: >... > - use strlcpy and snprintf > - check return values of the above > - fix other gratuituos diffs to OpenBSD; not a complete sync, > but better than nothing I would prefer to see the cleanups separately. Especially the getopt changes which merge getargs() into main() and rename av to argv. > I've sent this to -audit; it elicited comments about breaking K&R, > which I addressed, but no solid reviews. I noticed only a couple of minor style problems (similar to ones in the original code). You've done more than enough time as a ports-only (?) committer and should commit things more directly. Reviews are good of course if you can get them promptly. Bruce Bruce Evans <bde@zeta.org.au> writes: > > The attached patch fixes some overflows in jot(1) and syncs up to > > OpenBSD a little. Significant changes include: > > > > - use getopt > > - de-register > > - fix overflows in -b and -w options; old behavior: > >... > > - use strlcpy and snprintf > > - check return values of the above > > - fix other gratuituos diffs to OpenBSD; not a complete sync, > > but better than nothing > > I would prefer to see the cleanups separately. Especially the getopt > changes which merge getargs() into main() and rename av to argv. Separately from what? The fixes for overflows? If so, I think it's appropriate to do it all in one commit; the overflows were fixed by strcpy -> strlcpy fixes. It would seem odd to fix two of the bugs in one commit, and the rest in another one a few minutes later. I understand that it's nice to separate bugfixes from cleanups, but in this case the bugs are fixed by cleaning up the code (more so than usual). Dima Dorfman dima@unixfreak.org State Changed From-To: open->analyzed Committed my own patch. Responsible Changed From-To: freebsd-bugs->dd My MFC reminder. State Changed From-To: analyzed->closed mfc'd |
The attached patch fixes some overflows in jot(1) and syncs up to OpenBSD a little. Significant changes include: - use getopt - de-register - fix overflows in -b and -w options; old behavior: dima@hornet% jot -b `perl -e 'print "A" x 2000'` 5 Segmentation fault (core dumped) dima@hornet% jot -w `perl -e 'print "A" x 2000'` 5 Segmentation fault (core dumped) (this is my primary motivation for the patch) - use strlcpy and snprintf - check return values of the above - fix other gratuituos diffs to OpenBSD; not a complete sync, but better than nothing Fix: I've sent this to -audit; it elicited comments about breaking K&R, which I addressed, but no solid reviews. How-To-Repeat: dima@hornet% jot -b `perl -e 'print "A" x 2000'` 5 Segmentation fault (core dumped) dima@hornet% jot -w `perl -e 'print "A" x 2000'` 5 Segmentation fault (core dumped)