Bug 195837

Summary: [bugfix] Port games/bsdgames trek has a boundary condition bug
Product: Ports & Packages Reporter: Kenji Rikitake <kenji>
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: Closed FIXED    
Severity: Affects Many People Flags: bugzilla: maintainer-feedback? (adamw)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch for computer.c none

Description Kenji Rikitake 2014-12-09 23:59:38 UTC
Created attachment 150416 [details]
patch for computer.c

computer.c in bsdgames trek has a bug. Patch attached to fix this. Note: this is the upstream (Dragonfly) bug (not reported yet to Dragonfly).

See also https://github.com/jj1bdx/bsdtrek/commit/da9b15595e3bf52d6c5326f9d56dc3ad96d5e5fb
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-09 23:59:38 UTC
Auto-assigned to maintainer adamw@FreeBSD.org
Comment 2 Adam Weinberger freebsd_committer freebsd_triage 2014-12-10 00:09:49 UTC
What is the bug?
Comment 3 Kenji Rikitake 2014-12-10 00:48:49 UTC
(In reply to Adam Weinberger from comment #2)
> What is the bug?

Without the change the program will accept out-of-range quadrant numbers.
In trek.h, the values of the macros are defined as NQUADS = 8 and NSECTS = 10.
Comment 4 commit-hook freebsd_committer freebsd_triage 2014-12-12 15:15:52 UTC
A commit references this bug:

Author: adamw
Date: Fri Dec 12 15:15:35 UTC 2014
New revision: 374594
URL: https://svnweb.freebsd.org/changeset/ports/374594

Log:
  Fix a bounds-checking typo in trek. The number of sectors was being used
  to check input for the quadrant, and NSECTS > NQUADS.

  PR:		195837
  Submitted by:	Kenji Rikitake

Changes:
  head/games/bsdgames/Makefile
  head/games/bsdgames/files/patch-trek_computer.c
Comment 5 Adam Weinberger freebsd_committer freebsd_triage 2014-12-12 15:16:05 UTC
Committed. Thanks for your all work here, Kenji!