<html><head></head><body>Hi,<br><br>Truncating a file path silently is wrong. I thought that's obvious TBH.<br><br><div class="gmail_quote">Le 20 janvier 2020 17:22:18 GMT+02:00, Alexandre Janniaux <ajanni@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Unfortunately, I'm not sure I understand what problem you're talking<br>about. Can you be more explicit about it?<br><br>AFAIU in the current situation, there was no issues but only an unsafe<br>usage of strncpy which was not harmful as it was protected by an ending<br>'\0' character enforcement. I don't see what the warning is<br>highlighting otherwise.<br><br>Regards,<br>--<br>Alexandre Janniaux<br>Videolabs<br><br>On Mon, Jan 20, 2020 at 04:44:32PM +0200, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Hi,<br><br> The point is that the warning points to a real problem with the implementation, which the patch does not fix. And as a general rule, I'm against removing warnings without fixing the real problem.<br><br> Le 20 janvier 2020 15:51:03 GMT+02:00, Alexandre Janniaux <ajanni@videolabs.io> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">Hi,<br><br>There should be no functional differences as the null character is<br>forced in the end of the path. Copying one meaningful character less<br>would happend as soon as the path is already too long, and otherwise<br>only the strncpy null character is expected to be truncated, but is<br>ensured by the code following.<br><br>The documentation state that sun_path should contain a null-terminated<br>pathname so it doesn't look wrong to enforce the last \0 byte too. Am<br>I missing something?<br><br>I hope I'm clear enough,<br><br>Regards,<br>--<br>Alexandre Janniaux<br>Videolabs<br><br>On Mon, Jan 20, 2020 at 03:29:43PM +0200, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;">On second consideration, chopping the path is not correct behaviour.<br></blockquote>This patch is concealing the bug highlighted by the warning rather than<br>fixing it IMO.<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> Better drop the feature altogether as I dot think anyone's using it.<br><br> Le 20 janvier 2020 09:38:46 GMT+02:00, "Rémi Denis-Courmont"<br></blockquote><remi@remlab.net> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">OK, though I'd suggest removing Unix socket support entirely as the<br></blockquote></blockquote>old<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">RC "protocol" is not suitable for programmatic usage.<br><br>Le 19 janvier 2020 17:39:27 GMT+02:00, Alexandre Janniaux<br><ajanni@videolabs.io> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">Fortify enabled implies a warning if we use strncpy with a length<br></blockquote>equal<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">to the buffer size. As we fill the last item with a null character,<br></blockquote></blockquote></blockquote>we<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">can use length-1 instead as well.<hr> modules/control/rc.c | 2 +-<br> 1 file changed, 1 insertion(+), 1 deletion(-)<br><br>diff --git a/modules/control/rc.c b/modules/control/rc.c<br>index cd85602d59..dc37d352ad 100644<br>--- a/modules/control/rc.c<br>+++ b/modules/control/rc.c<br>@@ -1730,7 +1730,7 @@ static int Activate( vlc_object_t *p_this )<br>         }<br><br>         addr.sun_family = AF_LOCAL;<br>-        strncpy( addr.sun_path, psz_unix_path, sizeof(<br></blockquote></blockquote></blockquote>addr.sun_path<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">)<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">);<br>+        strncpy( addr.sun_path, psz_unix_path, sizeof(<br></blockquote></blockquote></blockquote>addr.sun_path<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">)<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">- 1 );<br>         addr.sun_path[sizeof( addr.sun_path ) - 1] = '\0';<br><br>         if (bind (i_socket, (struct sockaddr *)&addr, sizeof<br></blockquote></blockquote></blockquote>(addr))<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #e9b96e; padding-left: 1ex;">--<br>2.25.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote>--<br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez<br></blockquote></blockquote>excuser<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #fcaf3e; padding-left: 1ex;">ma brièveté.<br></blockquote>--<br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez<br></blockquote>excuser ma brièveté.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote>--<br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br></blockquote><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>