← Commit list

3e3bfb896

Ron Yorston
Ron Yorston
2016-03-22
SUCCESS Duration: 199s

Subject

ash: fix corruption of ${#var} if $var contains UTF-8 characters

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+2 -0
@@ -6692,6 +6692,8 @@ varvalue(char *name, int varflags, int flags, struct strlist *var_str_list)
if (subtype == VSLENGTH && len > 0) {
reinit_unicode_for_ash();
if (unicode_status == UNICODE_ON) {
+ STADJUST(-len, expdest);
+ discard = 0;
len = unicode_strlen(p);
}
}
shell/ash_test/ash-vars/var-utf8-length.right+1 -0
@@ -0,0 +1 @@
+26
shell/ash_test/ash-vars/var-utf8-length.tests+2 -0
@@ -0,0 +1,2 @@
+X=abcdÉfghÍjklmnÓpqrstÚvwcyz
+echo ${#X}