Page MenuHomeFreeBSD

iconv(1): Capsicumify
ClosedPublic

Authored by cem on Sep 18 2016, 4:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 8, 11:40 AM
Unknown Object (File)
Wed, Jan 8, 11:03 AM
Unknown Object (File)
Jan 1 2025, 2:42 PM
Unknown Object (File)
Oct 23 2024, 12:37 AM
Unknown Object (File)
Oct 23 2024, 12:36 AM
Unknown Object (File)
Oct 23 2024, 12:36 AM
Unknown Object (File)
Oct 23 2024, 12:36 AM
Unknown Object (File)
Oct 23 2024, 12:24 AM
Subscribers

Details

Summary

This takes the usual shortcut of only sandboxing the last input file.
It's a first cut and this program will be easy to adapt to sandbox all
files in the future.

iconv(1) has been changed to only open the conversion descriptor once,
since the input and output encodings are fixed over all inputs.
Instead, the descriptor is simply reset after each use (documented in
iconv(3) API).

The stdio APIs commonly need FSTAT, READ/WRITE, and IOCTL(TIOCGETA).
Maybe this could be put in some kind of common subroutine for stdio
descriptors.

Test Plan
  • iconv -f US-ASCII -t UTF-8 (tty input)
  • iconv -f US-ASCII -t UTF-8 foo.txt
  • iconv -f US-ASCII -t UTF-8 < foo.txt (stdin)
  • iconv -f US-ASCII -t UTF-8 foo.txt foo.txt - (iconv_t cd reuse)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cem retitled this revision from to iconv(1): Capsicumify.
cem updated this object.
cem edited the test plan for this revision. (Show Details)
cem added reviewers: emaste, allanjude, oshogbo.

Simplify by using helpers.

This revision was automatically updated to reflect the committed changes.