Bug 245476 - config(8) line parsing fragile
Summary: config(8) line parsing fragile
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Jason A. Harmening
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-09 14:19 UTC by Kyle Evans
Modified: 2020-04-13 00:36 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Evans freebsd_committer freebsd_triage 2020-04-09 14:19:56 UTC
get_word and get_quoted_word, at the very least, are currently quite fragile -- they're expecting short subjects, which won't necessarily be the case. This can be easily seen by reverting the parts of r359689 that doubled the line buffer sizes and observing the new output to stderr as it tries to parse too long of lines. Previously, we just clobbered memory past the line buffer and did the wrong thing.

r359689 was just a band-aid, though -- these sizes will need adjusted as needs change and randomly blow up on valid config bits. It would be nicer/more developer friendly to be more dynamic here.
Comment 1 Jason A. Harmening freebsd_committer freebsd_triage 2020-04-11 21:50:31 UTC
https://reviews.freebsd.org/D24373
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-04-12 02:43:17 UTC
A commit references this bug:

Author: jah
Date: Sun Apr 12 02:42:42 UTC 2020
New revision: 359815
URL: https://svnweb.freebsd.org/changeset/base/359815

Log:
  config(8): use sbuf to manage line buffers

  PR:	245476
  Reported by:	kevans
  Reviewed by:	imp, kevans
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D24373

Changes:
  head/usr.sbin/config/main.c