[Xastir-dev] Switching string length discussion to here

Curt Mills curt.we7u at gmail.com
Sun Dec 19 14:50:19 PST 2021


Rgr.  It's worth asking the question every few years to see if
anything new has come along that can help portability as well as
reliability. Sounds like nothing's come along yet.

On Sun, Dec 19, 2021 at 2:48 PM km5vy Tom Russo <russo at bogodyn.org> wrote:
>
> On Sun, Dec 19, 2021 at 02:37:24PM -0800, we recorded a bogon-computron collision of the <curt.we7u at gmail.com> flavor, containing:
> > Ah, should have read everything more thoroughly... So by adding
> > another library to Linux we might be able to use something better.
>
> I disagree:  by adding another library, we're adding dependencies that could
> just as easily be solved by using strncat correctly without any depedencies.
>
> The operative comment is:
>
> > > >   strlcpy() and strlcat() are not standard, neither ISO C nor POSIX. So,
> > > >   their use in portable programs is impossible.
>
>
> The fact that one can expect it to work in SOME places just fine and on linux
> with extra libraries doesn't make it portable.
>
> Further on in that discussion are descriptions of multiple packages that
> provide their own implementation of strlcat (just as we provide xastir_snprintf
> to provide the non-standard snprintf function), all different, just to
> assure portability.
>
> That's a mess, and with as little developer energy as we have I do not
> advocate adding an additional maintenance headache (either by tracking down
> dependencies or providing our own implementation) if it can be avoided with
> a little extra typing.
>
> > On Sun, Dec 19, 2021 at 2:36 PM Curt Mills <curt.we7u at gmail.com> wrote:
> > >
> > > Nope. I remember considering those before after a bunch of research. I
> > > think they're on some BSD-derived systems but they're not on Linux.
> > >
> > > On Sun, Dec 19, 2021 at 2:33 PM Tom Russo <russo at bogodyn.org> wrote:
> > > >
> > > > On Sun, Dec 19, 2021 at 03:27:07PM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> > > > > On Sun, Dec 19, 2021 at 03:25:28PM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> > > > > > On Sun, Dec 19, 2021 at 03:12:50PM -0600, we recorded a bogon-computron collision of the <godfreja at gmail.com> flavor, containing:
> > > > > > > There is also strlcat.
> > > > > >
> > > > > > Are these in the C standard, snprintf?
> > > > >
> > > > > "unlike snprintf"
> > > >
> > > > It appears that they are not standard in either ISO or POSIX standards.
> > > >
> > > > From https://stackoverflow.com/questions/2114896/why-are-strlcpy-and-strlcat-considered-insecure
> > > >
> > > >   strlcpy() and strlcat() are not standard, neither ISO C nor POSIX. So,
> > > >   their use in portable programs is impossible. In fact, strlcat() has
> > > >   two different variants: the Solaris implementation is different from
> > > >   the others for edge cases involving length 0. This makes it even less useful
> > > >   than otherwise.
> > > >
> > > > From the same discussion:
> > > >
> > > >   This API has been adopted by most modern operating systems and many
> > > >   standalone software packages, including OpenBSD (where it originated),
> > > >   Sun Solaris, FreeBSD, NetBSD, the Linux kernel, rsync and the GNOME project.
> > > >   The notable exception is the GNU standard C library, glibc [12], whose
> > > >   maintainer steadfastly refuses to include these improved APIs, labelling
> > > >   them "horribly inefficient BSD crap" [4], despite prior evidence that they
> > > >   are faster is most cases than the APIs they replace [13].
> > > >
> > > >   That is why they are not available in glibc, but it is not true that they
> > > >   are not available on Linux. They are available on Linux in libbsd:
> > > >
> > > >     https://libbsd.freedesktop.org/
> > > >
> > > >
> > > > --
> > > > Tom Russo    KM5VY
> > > > Tijeras, NM
> > > >
> > > >  echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]
> > > >
> > > > _______________________________________________
> > > > Xastir-dev mailing list
> > > > Xastir-dev at lists.xastir.org
> > > > http://xastir.org/mailman/listinfo/xastir-dev
> > >
> > >
> > >
> > > --
> > > Curt, WE7U        http://xastir.org        http://www.sarguydigital.com
> >
> >
> >
> > --
> > Curt, WE7U        http://xastir.org        http://www.sarguydigital.com
>
> --
> Tom Russo    KM5VY
> Tijeras, NM
>
>  echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]
>


-- 
Curt, WE7U        http://xastir.org        http://www.sarguydigital.com


More information about the Xastir-dev mailing list