Issue with top corrupting data from post when being used in CGI.

James Ronald james.ronald at gmail.com
Wed Sep 26 14:41:56 UTC 2012


There is an issue where top is corrupting stdin (consuming the first
byte or two) when being used in a CGI script and executed before
reading POST data being passed via standard in. Of course, executing
top after the read works just fine.  The issue exists in the recent
releases (1.20.x, 1.19.4) but did not exist in 1.18.5.

#!/bin/sh
echo "Content-type: text/plain"
top -n1 -b
[ "$REQUEST_METHOD" = "POST" ] && read QUERY_STRING
echo "QUERY_STRING=$QUERY_STRING"
env
echo ""

Best regards
- James Ronald


More information about the busybox mailing list