Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-08-19 21:22:45 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2016-08-19 21:24:49 +0300
commitca26f1c238c51b3b2f80dd25fd7fcf8774f38ca4 (patch)
tree77765ce82ef68797ff53fb0efede7ff45bd2b932 /modutils
parent8191abd146989652ce376f0e36c5e1adbea99fe1 (diff)
hush: fix a bug with "stdio rewind on exit". Closes 9186
With FEATURE_SH_STANDALONE=y, run this in a "sh SCRIPT": sha256sum /dev/null echo END sha256sum is a NOEXEC applet. It runs in a forked child. Then child exit()s. By this time, entire script is read, and buffered in a FILE object from fopen("SCRIPT"). But fgetc() did not consume entire input. exit() lseeks back by -9 bytes, from <eof> to 'e' in 'echo'. (this may be libc-specific). This change of fd position *is shared with the parent*! Now parent can read more, and it thinks there is another "echo END". End result: two "echo END"s are run. `cmd` and arithmetic also need the fix for this, even without FEATURE_SH_STANDALONE. Fix this by _exit()ing instead. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
0 files changed, 0 insertions, 0 deletions