[vfs] even stricter input checks in macOS filesystem event helper (IJ-CR-95917)

GitOrigin-RevId: dad56b8aa48b8c1ce6a71773d0058947490de332
This commit is contained in:
Roman Shevchenko
2022-10-07 19:39:28 +02:00
committed by intellij-monorepo-bot
parent 394d8ad5cf
commit 286647ca8b

View File

@@ -119,9 +119,9 @@ static char *read_stdin() {
if (result == NULL || feof(stdin)) { if (result == NULL || feof(stdin)) {
return NULL; return NULL;
} }
size_t pos = strlen(input_buf) - 1; size_t length = strlen(input_buf);
if (input_buf[pos] == '\n') { if (length > 0 && input_buf[length - 1] == '\n') {
input_buf[pos] = '\0'; input_buf[length - 1] = '\0';
} }
return input_buf; return input_buf;
} }