- cut.c: cut_marked_segment() - Fix off-by one in mem allocation

git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_1_0_branch/nano@869 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2001-10-23 13:21:20 +00:00
parent 22bae9812c
commit 89eb1aaad8
2 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,9 @@ CVS code -
- Fixed null_at to ACTUALLY DO SOMETHING with its arg. Again,
this was causing nasty errors if the call to nrealloc moved
where the data was located.
- cut.c:
cut_marked_segment()
- Fix off-by one in mem allocation.
- po/de.po:
- Updated German translation (Karl Eichwalder).

2
cut.c
View File

@ -90,7 +90,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
if (next == NULL)
return;
/* Now, paste bot[bot_x] into top[top_x] */
tmpstr = nmalloc(strlen(top->data) + strlen(&bot->data[bot_x]));
tmpstr = nmalloc(top_x + strlen(&bot->data[bot_x]) + 1);
strncpy(tmpstr, top->data, top_x);
strcpy(&tmpstr[top_x], &bot->data[bot_x]);
free(top->data);