| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5790c40 commit e09f7f0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -144,7 +144,10 @@ std::string GetProcessTitle(const char* default_title) { | |||
| 144 | 144 | if (rc == 0) | |
| 145 | 145 | break; | |
| 146 | 146 | ||
| 147 | - if (rc != UV_ENOBUFS) | ||
| 147 | + // If uv_setup_args() was not called, `uv_get_process_title()` will always | ||
| 148 | + // return `UV_ENOBUFS`, no matter the input size. Guard against a possible | ||
| 149 | + // infinite loop by limiting the buffer size. | ||
| 150 | + if (rc != UV_ENOBUFS || buf.size() >= 1024 * 1024) | ||
| 148 | 151 | return default_title; | |
| 149 | 152 | ||
| 150 | 153 | buf.resize(2 * buf.size()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments