Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Curt Mills
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 wrote: > > On Sun, Dec 19, 2021 at 02:37:24PM -0800, we recorded a

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread km5vy Tom Russo
On Sun, Dec 19, 2021 at 02:37:24PM -0800, we recorded a bogon-computron collision of the 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

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Curt Mills
Ah, should have read everything more thoroughly... So by adding another library to Linux we might be able to use something better. On Sun, Dec 19, 2021 at 2:36 PM Curt Mills wrote: > > Nope. I remember considering those before after a bunch of research. I > think they're on some BSD-derived

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Curt Mills
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 wrote: > > On Sun, Dec 19, 2021 at 03:27:07PM -0700, we recorded a bogon-computron > collision of the flavor,

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
On Sun, Dec 19, 2021 at 03:27:07PM -0700, we recorded a bogon-computron collision of the flavor, containing: > On Sun, Dec 19, 2021 at 03:25:28PM -0700, we recorded a bogon-computron > collision of the flavor, containing: > > On Sun, Dec 19, 2021 at 03:12:50PM -0600, we recorded a

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
On Sun, Dec 19, 2021 at 03:25:28PM -0700, we recorded a bogon-computron collision of the flavor, containing: > On Sun, Dec 19, 2021 at 03:12:50PM -0600, we recorded a bogon-computron > collision of the flavor, containing: > > There is also strlcat. > > Are these in the C standard, snprintf?

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
Heh. From the strlcpy/strlcat man page on my system: The strlcpy() and strlcat() functions copy and concatenate strings with the same input parameters and output result as snprintf(3). They are designed to be safer, more consistent, and less error prone replacements for the

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
On Sun, Dec 19, 2021 at 03:12:50PM -0600, we recorded a bogon-computron collision of the flavor, containing: > There is also strlcat. Are these in the C standard, snprintf? Looks like they may be. If so, the fact that they take the full size of the destination array instead of "whatever's

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Jason Godfrey
There is also strlcat. - Jason On Sun, Dec 19, 2021 at 11:58 AM Tom Russo wrote: > Oh, and certainly you *could* use "xastir_snprintf" to do a sort of strncat > operation: > >xastir_snprintf(dest,dest_size,"%s%s",dest,src); > > instead of >strncat(dest,src,dest_size-1-strnlen(dest)); >

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
Oh, and certainly you *could* use "xastir_snprintf" to do a sort of strncat operation: xastir_snprintf(dest,dest_size,"%s%s",dest,src); instead of strncat(dest,src,dest_size-1-strnlen(dest)); but that would be less efficient (because of all the format processing and such in

Re: [Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Tom Russo
I am generally not enamored of non-standard string libraries. They add a new dependency, they subject our code to the maintenance whims of other projects, and there's an easy, standard fix that uses the standard C libraries. For example, in the very code that we're referring to, there are both

[Xastir-dev] Switching string length discussion to here

2021-12-19 Thread Curt Mills
Tom, Thanks for your recent explanation in the issue discussion (Issue #188). This is good general "string" talk and applicable to a wide range of code. For that reason I'm moving the discussion here so it's more easily found later, instead of hidden in Github issue comments. Pardon me while I