- files.c:save_history() Fix off-by-one bug causing write to unallocated memory (David Benbennick)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1417 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
434d686ee4
commit
c45335782a
|
@ -60,6 +60,8 @@ CVS Code -
|
||||||
mode on. (DLR; found by David Benbennick)
|
mode on. (DLR; found by David Benbennick)
|
||||||
save_history()
|
save_history()
|
||||||
- Fix nrealloc return value being ignored (David Benbennick).
|
- Fix nrealloc return value being ignored (David Benbennick).
|
||||||
|
- Fix off-by-one bug causing write to unallocated memory
|
||||||
|
(David Benbennick).
|
||||||
- global.c:
|
- global.c:
|
||||||
thanks_for_all_the_fish()
|
thanks_for_all_the_fish()
|
||||||
- Fix compiling with DEBUG and multibuffer (David Benbennick).
|
- Fix compiling with DEBUG and multibuffer (David Benbennick).
|
||||||
|
|
4
files.c
4
files.c
|
@ -2932,7 +2932,7 @@ void save_history(void)
|
||||||
chmod(nanohist, S_IRUSR | S_IWUSR);
|
chmod(nanohist, S_IRUSR | S_IWUSR);
|
||||||
/* write oldest first */
|
/* write oldest first */
|
||||||
for (h = search_history.tail ; h->prev ; h = h->prev) {
|
for (h = search_history.tail ; h->prev ; h = h->prev) {
|
||||||
h->data = nrealloc(h->data, strlen(h->data) + 1);
|
h->data = nrealloc(h->data, strlen(h->data) + 2);
|
||||||
strcat(h->data, "\n");
|
strcat(h->data, "\n");
|
||||||
if (fputs(h->data, hist) == EOF) {
|
if (fputs(h->data, hist) == EOF) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
||||||
|
@ -2944,7 +2944,7 @@ void save_history(void)
|
||||||
goto come_from;
|
goto come_from;
|
||||||
}
|
}
|
||||||
for (h = replace_history.tail ; h->prev ; h = h->prev) {
|
for (h = replace_history.tail ; h->prev ; h = h->prev) {
|
||||||
h->data = nrealloc(h->data, strlen(h->data) + 1);
|
h->data = nrealloc(h->data, strlen(h->data) + 2);
|
||||||
strcat(h->data, "\n");
|
strcat(h->data, "\n");
|
||||||
if (fputs(h->data, hist) == EOF) {
|
if (fputs(h->data, hist) == EOF) {
|
||||||
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
rcfile_msg(_("Unable to write ~/.nano_history file, %s"), strerror(errno));
|
||||||
|
|
Loading…
Reference in New Issue