Jinoh Kang (@iamahuman) commented about dlls/windows.media.speech/unixlib.c:
+ * so we don't try to do another lang match. + */ + if (best_match || strncmp(ent_name, locale, delim - locale)) + continue; + } + + if (fstatat(fd, dirent->d_name, &stat, 0)) + { + WARN("Failed to get stats for entry %s.\n", debugstr_a(dirent->d_name)); + continue; + } + + if (!S_ISDIR(stat.st_mode)) + continue; + + best_match = dirent->d_name; The pointer `dirent->d_name` becomes invalid the next time you call `readdir`, which may reuse or free the buffer.
From `readdir(3)`:
The data returned by readdir() may be overwritten by subsequent calls to readdir() for the same directory stream.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2091#note_26212