浏览代码

Utilities: Allow for white spaces in lsof name parsing

Previously lsof would crash by incorrectly parsing valid file names
that contain spaces.

For example, established TCP socket file descriptors would cause an
lsof crash:

	socket:127.0.0.1:33985 / 127.0.0.1:8080 (connected)

This commit fixes the issue by not parsing for white spaces to set the
file name.
brapru 4 年之前
父节点
当前提交
b985eb1613
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Utilities/lsof.cpp

+ 1 - 1
Userland/Utilities/lsof.cpp

@@ -38,7 +38,7 @@ static bool parse_name(StringView name, OpenFile& file)
         return true;
     } else {
         file.type = component1;
-        auto component2 = lexer.consume_while([](char c) { return isprint(c) && !isspace(c) && c != '('; });
+        auto component2 = lexer.consume_while([](char c) { return isprint(c) && c != '('; });
         lexer.ignore_while(isspace);
         file.name = component2;