Fix CVE-2025-9810

This commit is contained in:
Garry T. Williams
2025-09-10 09:48:24 -04:00
committed by GitHub
parent d895173d67
commit f2558e1e58

View File

@@ -1318,7 +1318,7 @@ int linenoiseHistorySave(const char *filename) {
fp = fopen(filename,"w");
umask(old_umask);
if (fp == NULL) return -1;
chmod(filename,S_IRUSR|S_IWUSR);
fchmod(fileno(fp),S_IRUSR|S_IWUSR);
for (j = 0; j < history_len; j++)
fprintf(fp,"%s\n",history[j]);
fclose(fp);