Bug 205569 - multimedia/oscam: port updated to contain rc.d script and new feature of dvbapi
Summary: multimedia/oscam: port updated to contain rc.d script and new feature of dvbapi
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thomas Zander
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-12-24 11:51 UTC by Franz Bettag
Modified: 2016-01-03 15:58 UTC (History)
2 users (show)

See Also:


Attachments
diff -Nru from the o to the r to the i and g (3.50 KB, patch)
2015-12-24 11:51 UTC, Franz Bettag
no flags Details | Diff
Revised patch including fix for out of bounds access in module-dvbapi.c (4.84 KB, patch)
2015-12-29 15:11 UTC, Thomas Zander
riggs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Franz Bettag 2015-12-24 11:51:42 UTC
Created attachment 164589 [details]
diff -Nru from the o to the r to the i and g

Santa was just here and gave me a bottle of Porter-Juice, which i'm sure was on all of your wishlists as well. Anyway, after drinking said potion, i wrote an rc.d-script as well as a patch for enabling dvbapi, where i commented a small code-block (as seen in the patch) to just enable newer versions of the protocol used to communicated with  multimedia/tvheadend. Before communication was not possible due to dvbapi not being compiled at all. This revision fixes those two problems.

Tested on 9.3-i386, 9.3-amd64, 10.2-i386, 10.2-amd64.

thanks for your consideration!

Merry christmas to all y'all!
Comment 1 Thomas Zander freebsd_committer freebsd_triage 2015-12-25 10:42:04 UTC
This seems fishy: From build log

[...]
module-dvbapi.c:4304:2: warning: array index 107 is past the end of the array (which contains 104 elements) [-Warray-bounds]
        saddr.sun_path[107] = '\0';
        ^              ~~~
/usr/include/sys/un.h:50:2: note: array 'sun_path' declared here
        char    sun_path[104];          /* path name (gag) */
        ^
[...]

We should ensure not to write past array bounds. Could you take a look?
Comment 2 Franz Bettag 2015-12-25 13:52:16 UTC
(In reply to Thomas Zander from comment #1)

Yes i noticed that one too, but my C skill is not sufficient enough to judge if this is intended or not, since the 2nd warning implies that the author is doing some other stunt which seems to handle the 104-element thingy. Since it's not my code, i can't speak for it.

In any case, the module seems to work.
Comment 3 Thomas Zander freebsd_committer freebsd_triage 2015-12-29 15:11:21 UTC
Created attachment 164822 [details]
Revised patch including fix for out of bounds access in module-dvbapi.c

Here is a revised version of your patch that fixes this out of bounds access. I have done three things here:
1) Change the pmt_server_socket string from a preprocessor directive to a const char array.
2) Have the compiler correctly calculate the length of saddr.sun_path string from /usr/include/sys/un.h at compile time.
3) Remove superfluous manual past-array-bounds string termination. strncpy already ensures proper string termination since on FreeBSD it is guaranteed that sun_path is longer than the pmt_server_socket string from 1)

Could you verify whether this works as expected?
Comment 4 Franz Bettag 2015-12-29 15:14:00 UTC
(In reply to Thomas Zander from comment #3)
Thanks for this! I'll do my best to try this out this year and give you feedback!
Comment 5 Franz Bettag 2016-01-03 14:15:42 UTC
(In reply to Franz Bettag from comment #4)
seems to run perfectly :)
Comment 6 Thomas Zander freebsd_committer freebsd_triage 2016-01-03 15:51:38 UTC
Comment on attachment 164822 [details]
Revised patch including fix for out of bounds access in module-dvbapi.c

Maintainer has tested and verified new patch.
Comment 7 commit-hook freebsd_committer freebsd_triage 2016-01-03 15:56:23 UTC
A commit references this bug:

Author: riggs
Date: Sun Jan  3 15:55:23 UTC 2016
New revision: 405166
URL: https://svnweb.freebsd.org/changeset/ports/405166

Log:
  Add rc script, enable communication with multimedia/tvheadend

  PR:		205569
  Submitted by:	franz@bett.ag (maintainer)
  Reviewed by:	riggs
  Approved by:	franz@bett.ag (maintainer)

Changes:
  head/multimedia/oscam/Makefile
  head/multimedia/oscam/files/oscam.in
  head/multimedia/oscam/files/patch-config.h
  head/multimedia/oscam/files/patch-module-dvbapi.c
Comment 8 Franz Bettag 2016-01-03 15:58:30 UTC
thank you!