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!
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?
(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.
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?
(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!
(In reply to Franz Bettag from comment #4) seems to run perfectly :)
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.
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
thank you!