Merge pull request #240 from gtwilliams/patch-1

Fix CVE-2025-9810
This commit is contained in:
Salvatore Sanfilippo
2025-09-10 17:27:26 +02:00
committed by GitHub

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);