Bug 245476

Summary: config(8) line parsing fragile
Product: Base System Reporter: Kyle Evans <kevans>
Component: binAssignee: Jason A. Harmening <jah>
Status: Closed FIXED    
Severity: Affects Only Me CC: emaste, jah
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

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