Date: Fri, 08 Feb 2013 22:46:18 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: ports@FreeBSD.org, Brooks Davis <brooks@freebsd.org>, Bryan Drewery <bdrewery@FreeBSD.org>, Dewayne Geraghty <dewayne.geraghty@heuristicsystems.com.au> Subject: Re: openssh-portable segmentation faults Message-ID: <5115722A.3050400@FreeBSD.org> In-Reply-To: <20130207232853.GO2522@kib.kiev.ua> References: <67A39057348F4D1BA43004DB5F0E8DBB@white> <5113B343.303@FreeBSD.org> <CD64A9A7097A415CB05541C9032576D1@white> <511435D8.8000900@FreeBSD.org> <20130207232853.GO2522@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2013-02-08 00:28, Konstantin Belousov wrote: > On Fri, Feb 08, 2013 at 12:16:40AM +0100, Dimitry Andric wrote: ... >> I guess a similar approach as take in the above thread should be taken, >> e.g. rename the function in the port to openbsd_strnvis(), and have the >> port call that. Or use macro trickery to swap the arguments... :) > > I suggest taking a reverse approach, and rename our libc function to > e.g. NetBSD_strnvis(). This way, at least linking binaries would > result in the build-time failure. For shared libraries, we also get > some semi-helpful message from rtld which would allow to identify > the problem without obtaining the backtrace. Anyway, the porter will > see the issue cleanly. > > This should be done before merging the libc changes to stable. The merge to stable/9 was already done in r245439. :-/ Unfortunately, this function is not standardized, but at first sight, the NetBSD prototype: int strnvis(char *dst, size_t dlen, const char *src, int flag); is more logical than the OpenBSD prototype: int strnvis(char *dst, const char *src, size_t siz, int flag) because the 'siz' argument is really the length of 'dst'. On the other hand, OpenBSD added this function in 2000, while NetBSD was late to the party in 2011... :) That said, it is possible the semantics of the NetBSD implementation are subtly different from what OpenSSH expects, so it is safer to let the port use its own implementation anyway. The question is also how many third-party software uses strnvis(), and what the prevalent expectation is about the argument order. If most external software expects the OpenBSD order, it would be better to use that instead.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5115722A.3050400>