[Bug 8506] ash: corrupted expansion of ${#var} if $var contains UTF-8 characters

bugzilla at busybox.net bugzilla at busybox.net
Sun Jan 3 10:04:24 UTC 2016


https://bugs.busybox.net/show_bug.cgi?id=8506

--- Comment #4 from Hans PUFAL <hans.pufal at gmail.com> ---
I have a possible fix but need someone who knows the code to check for any side
effects.

In file ash.c, line 6703

    if (discard)
        STADJUST(-len, expdest);

At this point len is the unicode string length and STADJUST is removing the 
$var string from the destination. The length of the removal should be the
number of bytes in the string not the unicode string length.

Changing line 6704 to 

        STADJUST(-strlen (p), expdest);

Makes the tests run correctly.

I am fairly sure of my analisys but am unsure if this could cause problems
in other situations.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list