Re: option parsing for --log still broken

Klaus Schmidinger <[email protected]> Tue, 17 Nov 2020 18:15:51 +0100
Newsgroups gmane.linux.vdr
Message-ID <[email protected]>
On 17.11.20 12:17, Harald Milz wrote:
> Hi Klaus and all,
> 
> it appears that option parsing for the --log option is still broken, as
> described in this thread: https://www.vdr-portal.de/forum/index.php?thread/108924-gel%C3%B6st-logging-von-yavdr-in-separaten-logfiles-anstelle-des-syslog-und-probleme/
> ...

In your patch, if optarg is longer than 3 characters, strncpy() wouldn't terminate
'copy' with 0.

This should do, too:

--- vdr.c       2020/05/18 16:47:29     4.33
+++ vdr.c       2020/11/17 17:11:51
@@ -422,6 +422,7 @@
                            SysLogLevel = l;
                            if (!p)
                               break;
+                          *p = '.';
                            if (isnumber(p + 1)) {
                               int l = atoi(p + 1);
                               if (0 <= l && l <= 7) {

The first break doesn't matter, because p is NULL in that case and thus optarg has
not been changed.

Klaus

_______________________________________________
vdr mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr