Index | Thread | Search

From:
Tobias Stoeckmann <tobias@stoeckmann.org>
Subject:
Re: stravis: properly handle long strings
To:
Theo de Raadt <deraadt@openbsd.org>
Cc:
tech@openbsd.org
Date:
Thu, 11 Jul 2024 20:37:30 +0200

Download raw body.

Thread
On Thu, Jul 11, 2024 at 01:50:04AM GMT, Theo de Raadt wrote:
> Can we change the vis functions to all return size_t instead of int,
> without any real userland breakage?  It would be snuck into the next
> libc ABI crank.

The strnunvis function already returns ssize_t. We can copy that for
stravis and others which can actually return an error value of -1.

Using ssize_t for all of them would reduce issues with ports where
a signed return value is already expected, but it doesn't feel like
"the right choice." Talking about strnunvis, it's int for libbsd and
FreeBSD, so vis/unvis already differ slightly across systems.

I can prepare a patch which uses ssize_t where needed and size_t for
all functions which cannot fail.

> The internals are easy to change.

Yes, with a proper API the patch will be much cleaner.


Tobias