~vcs-imports/busybox/trunk

  • Committer: Denys Vlasenko
  • Author(s): zhuyan
  • Date: 2023-08-31 00:20:19 UTC
  • Revision ID: git-v1:ed4a24dfd10539e144ed4b7de008f8791d09a551
ash: initialize basepf.buf in ash

When I planned to print the command in read_line_input, I found that after
the system started, the command printed for the first time was always
garbled.

After analysis, it is found that in the init() function of ash, the
variable basepf.buf is not initialized after applying for memory, resulting
in garbled initial data. Then assign it to the global variable
g_parsefile->buf in ash.c, and then pass g_parsefile->buf to the parameter
command of the function read_line_input in the function preadfd(), and
finally cause it to be garbled when the command is printed by
read_line_input.

The call stack is as follows:
 #0  read_line_input (st=0xb6fff220, prompt=0xb6ffc910 "\\[\\033[32m\\]\\h \\w\\[\\033[m\\] \\$ ", command=command@entry=0xb6ffc230 "P\325\377\266P\325\377\266", maxsize=maxsize@entry=1024) at libbb/lineedit.c:2461
 #1  0x0043ef8c in preadfd () at shell/ash.c:10812
 #2  preadbuffer () at shell/ash.c:10914
 #3  pgetc () at shell/ash.c:10997
 #4  0x00440c20 in pgetc_eatbnl () at shell/ash.c:11039
 #5  0x00440cbc in xxreadtoken () at shell/ash.c:13157
 #6  0x00440f40 in readtoken () at shell/ash.c:13268
 #7  0x00441234 in list (nlflag=nlflag@entry=1) at shell/ash.c:11782
 #8  0x004420e8 in parsecmd (interact=<optimized out>) at shell/ash.c:13344
 #9  0x00442c34 in cmdloop (top=top@entry=1) at shell/ash.c:13549
 #10 0x00444e4c in ash_main (argc=<optimized out>, argv=0x444e4c <ash_main+1328>) at shell/ash.c:14747
 #11 0x00407954 in run_applet_no_and_exit (applet_no=9, name=<optimized out>, argv=0xbefffd34) at libbb/appletlib.c:1024
 #12 0x00407b68 in run_applet_and_exit (name=0xbefffe56 "ash", argv=0x9) at libbb/appletlib.c:1047
 #13 0x00407f88 in main (argc=<optimized out>, argv=0xbefffd34) at libbb/appletlib.c:1181

Fixes: 82dd14a510ca ("ash: use CONFIG_FEATURE_EDITING_MAX_LEN")

Signed-off-by: zhuyan <zhuyan34@huawei.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Filename Latest Rev Last Changed Committer Comment Size
..
applets 1 24 years ago Eric Andersen Initial revision Diff
applets_sh 12583 12 years ago Denys Vlasenko applets_sh/nologin: an applet implemented as shell Diff
arch 6385 17 years ago Denis Vlasenko build system: fix for non-i386 builds Diff
archival 1 24 years ago Eric Andersen Initial revision Diff
configs 12417 12 years ago Denys Vlasenko Support configuring Busybox from _defconfig files Diff
console-tools 1 24 years ago Eric Andersen Initial revision Diff
coreutils 1 24 years ago Eric Andersen Initial revision Diff
debianutils 2234 22 years ago Eric Andersen Commit the start-stop-daemon applet. This was con Diff
docs 204 24 years ago Erik Andersen More adjustments -Erik Diff
e2fsprogs 6737 17 years ago Denis Vlasenko put small subset of e2fsprogs back in the tree: ls Diff
editors 57 24 years ago Eric Andersen Stuf Diff
examples 1 24 years ago Eric Andersen Initial revision Diff
findutils 1 24 years ago Eric Andersen Initial revision Diff
include 898 23 years ago Eric Andersen Add in busybox.h. I renamed it, and forgot to com Diff
init 1 24 years ago Eric Andersen Initial revision Diff
klibc-utils 15010 6 years ago Denys Vlasenko klibc-utils: new applets: resume, nuke, minips mi Diff
libbb 852 23 years ago Eric Andersen More portable handling of loop header files, as do Diff
libpwdgrp 2605 21 years ago Robert Griebl Bigger patch for (partial) tinylogin integration - Diff
loginutils 2605 21 years ago Robert Griebl Bigger patch for (partial) tinylogin integration - Diff
mailutils 9577 15 years ago Denis Vlasenko add mailutils/* Diff
miscutils 1 24 years ago Eric Andersen Initial revision Diff
modutils 159 24 years ago Erik Andersen Added lsmod -Erik Diff
networking 121 24 years ago Eric Andersen Stuf Diff
printutils 8463 16 years ago Denis Vlasenko lpr and lpq applets by Walter Harms. text d Diff
procps 1 24 years ago Eric Andersen Initial revision Diff
qemu_multiarch_testing 13695 8 years ago Denys Vlasenko Add qemu_multiarch_testing/ Signed-off-by: Denys Diff
runit 6357 17 years ago Denis Vlasenko Yeah, yeah... I forgot about 'svn add'... fixing t Diff
scripts 195 24 years ago Erik Andersen Add in sample inittab file -Erik Diff
selinux 7071 17 years ago Denis Vlasenko new applets: selinux utils by KaiGai Kohei <kaigai Diff
shell 289 24 years ago Erik Andersen First pass at writing a shell for busybox. Works f Diff
sysklogd 106 24 years ago Eric Andersen First draft Diff
testsuite 2280 22 years ago Matt Kraai Merge test suite. Diff
util-linux 1 24 years ago Eric Andersen Initial revision Diff
.gitignore 15686 5 years ago Denys Vlasenko Treat custom and applet scripts as applets BusyBo 479 bytes Diff Download File
.indent.pro 697 23 years ago Mark Whitley First revision of the Busybox Style Guide and an a 871 bytes Diff Download File
AUTHORS 17475 1 year ago Denys Vlasenko tree: new applet Adds the tree program to list di 5.2 KB Diff Download File
busybox_ldscript.README.txt 17389 2 years ago Denys Vlasenko add busybox_ldscript.README.txt Signed-off-by: De 2 KB Diff Download File
Config.in 17599 1 year ago Denys Vlasenko build system: fix "Config.in:117 error: Overlong l 23.1 KB Diff Download File
INSTALL 12713 12 years ago Denys Vlasenko Tweak INSTALL text Signed-off-by: Denys Vlasenko 5.9 KB Diff Download File
LICENSE 10187 15 years ago Mike Frysinger LICENSE: update address of the FSF Signed-off-by: 17.9 KB Diff Download File
File make_single_applets.sh 16529 3 years ago Denys Vlasenko make_single_applets.sh: switch off nologin deps op 3.3 KB Diff Download File
Makefile 17587 1 year ago Bernhard Reutner-Fischer build system: clean more files on make clean Sign 42 KB Diff Download File
Makefile.custom 15455 6 years ago Denys Vlasenko applets/install: don't try to install nothing Com 6.2 KB Diff Download File
Makefile.flags 17597 1 year ago Denys Vlasenko build system: Make it possible to build with 64bit 7.9 KB Diff Download File
Makefile.help 13246 10 years ago Denys Vlasenko build system: "make hosttools" doesn't exist, remo 1.8 KB Diff Download File
NOFORK_NOEXEC.lst 15160 6 years ago Denys Vlasenko mv: make it NOEXEC Signed-off-by: Denys Vlasenko 13.6 KB Diff Download File
File NOFORK_NOEXEC.sh 15161 6 years ago Denys Vlasenko NOFORK_NOEXEC.sh: a script to find "interesting" a 718 bytes Diff Download File
README 13598 9 years ago Denys Vlasenko typo fix Signed-off-by: Denys Vlasenko <vda.linux 8.5 KB Diff Download File
File size_single_applets.sh 16072 5 years ago Denys Vlasenko config: add size information for three more applet 2.2 KB Diff Download File
TODO 14842 6 years ago Denys Vlasenko libbb: remove vdprintf Two reasons: * it's only 11.2 KB Diff Download File
TODO_unicode 10996 14 years ago Denys Vlasenko ls: unicode fixes Signed-off-by: Denys Vlasenko < 731 bytes Diff Download File