tinker icon indicating copy to clipboard operation
tinker copied to clipboard

revert and fix parse cmdline bug

Open waruqi opened this issue 3 years ago • 1 comments

cmdline 这块解析之前还能正常跑,新版本直接获取到一串非截断乱码。

while (len > 0 && (buf[len - 1] <= 0 || buf[len - 1] == 10 || buf[len - 1] == 13)) --len;

问题1: 为啥要改成尾遍历,如果 X 是无效字符,abd X edf XXXX 中间如果出现部分有效字符,这样获取的 len 就是有问题的,得从 0 开始遍历才对。

return new String(buf, StandardCharsets.US_ASCII);

问题2: 最后那个 len 算完,也没用进去哈。。。

waruqi avatar Aug 16 '22 08:08 waruqi

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

tencent-adm avatar Aug 16 '22 08:08 tencent-adm