bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Corrupted multibyte characters in command substitutions fixes may be


From: Lawrence Velázquez
Subject: Re: Corrupted multibyte characters in command substitutions fixes may be worse than problem.
Date: Mon, 07 Feb 2022 01:45:35 -0500
User-agent: Cyrus-JMAP/3.5.0-alpha0-4586-g104bd556f9-fm-20220203.002-g104bd556

On Mon, Feb 7, 2022, at 1:26 AM, Alex fxmbsw7 Ratchev wrote:
> well i saw now, printf a char of "\0" results in 0 bytes out to wc -c

% /usr/bin/printf '\0' | wc -c
       1


> however my solution still stays
> you just use memory locations instead of c strings
> and those entries in memory are of course of known length, before setting
> and all is fine

"Your" solution is decades old.  Everyone knows how Pascal-style
strings work.  This is not cutting-edge computer science.


> of course this means to not use these fauly 'c strings', but a self
> coded solution

As Greg already mentioned, such a system requires converting back
to C strings for system calls and other external APIs.  It's not
insurmountable, but it's more involved than just swapping all your
char * to my_string or whatever.

I repeat:

>> It's so simple that you should have no problem converting the entire
>> bash codebase to Pascal-style strings yourself.  We'll wait.


-- 
vq



reply via email to

[Prev in Thread] Current Thread [Next in Thread]