fix issue with read builtin delimiter in invaild mutibyte char; fix crash if caller passes negative count argument to one of the history file writing functions

This commit is contained in:
Chet Ramey committed 2024-08-09 10:01:38 -04:00
1 parent e45ec6f76b
commit 772e7e760e
19 files changed
+3135 -2976

No files matched your search

+3
View File
@@ -745,6 +745,9 @@ history_do_write (const char *filename, int nelements, int overwrite)
history_lines_written_to_file = 0;
if (nelements < 0)
return (0);
mode = overwrite ? O_RDWR|O_CREAT|O_TRUNC|O_BINARY : O_RDWR|O_APPEND|O_BINARY;
#else
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;