Bug 172566 - Fix analyzer warnings in /games
Summary: Fix analyzer warnings in /games
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Eitan Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-10 12:00 UTC by Erik Cederstrand
Modified: 2013-02-03 03:47 UTC (History)
0 users

See Also:


Attachments
file.diff (1.54 KB, patch)
2012-10-10 12:00 UTC, Erik Cederstrand
no flags Details | Diff
fortune.txt (481 bytes, text/plain; x-unix-mode=0644)
2012-10-22 12:18 UTC, Erik Cederstrand
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Cederstrand 2012-10-10 12:00:00 UTC
Fix 4 warnings in /games reported by Clang Static Analyzer: 

bcd and caesar are not installed SETGID (at least on my system). Remove the call to setgid() as it becomes redundant.

In fortune, make sure a tail file is passed in the args if mandated in the logic. Bail if not.

In random(6), fix a memory leak in randomize_fd()

Fix: Se attached patch

Patch attached with submission follows:
Comment 1 Erik Cederstrand 2012-10-10 12:20:42 UTC
Den 10/10/2012 kl. 13.00 skrev FreeBSD-gnats-submit@freebsd.org:

>> Category:       misc
>> Responsible:    freebsd-bugs
>> Synopsis:       Fix analyzer warnings in /games
>> Arrival-Date:   Wed Oct 10 11:00:00 UTC 2012

Forgot to link to the reports: =
http://scan.freebsd.your.org/freebsd-head/games/2012-10-07-amd64/

Erik=
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2012-10-10 13:37:09 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-10-13 05:45:43 UTC
State Changed
From-To: open->analyzed

I've submitted changes for bcd, caesar, and random. fortune appears to 
be a false positive - although an assert might help.
Comment 4 Erik Cederstrand 2012-10-22 12:18:55 UTC
Here's a new patch for fortune with an assert() instead.

Thanks,
Erik
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2012-10-26 00:24:19 UTC
State Changed
From-To: analyzed->patched

committed in HEAD
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2013-02-03 03:47:40 UTC
State Changed
From-To: patched->closed

I shall not MFC this PR