mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
Fix fatal memory allocation bug.
This commit is contained in:
parent
d724d48440
commit
0a34781d29
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=90449
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= nano
|
||||
PORTVERSION= 1.2.2
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= editors
|
||||
MASTER_SITES= http://www.nano-editor.org/dist/v1.2/
|
||||
|
||||
@ -29,10 +29,4 @@ post-install:
|
||||
${MKDIR} ${EXAMPLESDIR}
|
||||
${INSTALL_DATA} ${WRKSRC}/nanorc.sample ${EXAMPLESDIR}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} > 500000
|
||||
BROKEN= "memory allocation bug"
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
||||
.include <bsd.port.mk>
|
||||
|
56
editors/nano/files/patch-files.c
Normal file
56
editors/nano/files/patch-files.c
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
--- files.c.orig Sun Oct 5 02:30:55 2003
|
||||
+++ files.c Sun Oct 5 02:35:06 2003
|
||||
@@ -1701,16 +1701,17 @@
|
||||
#ifdef NANO_EXTRA
|
||||
static int did_cred = 0;
|
||||
#endif
|
||||
+ static char *writepath = NULL;
|
||||
|
||||
#if !defined(DISABLE_BROWSER) || (!defined(DISABLE_MOUSE) && defined(NCURSES_MOUSE_VERSION))
|
||||
currshortcut = writefile_list;
|
||||
#endif
|
||||
|
||||
- answer = mallocstrcpy(answer, path);
|
||||
+ writepath = mallocstrcpy(writepath, path);
|
||||
|
||||
if (exiting && ISSET(TEMP_OPT)) {
|
||||
if (filename[0] != '\0') {
|
||||
- i = write_file(answer, 0, 0, 0);
|
||||
+ i = write_file(writepath, 0, 0, 0);
|
||||
display_main_list();
|
||||
return i;
|
||||
} else {
|
||||
@@ -1751,24 +1752,24 @@
|
||||
"%s%s%s", _("Write Selection to File"), formatstr, backupstr);
|
||||
} else {
|
||||
if (append == 2)
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Prepend to"), formatstr, backupstr);
|
||||
else if (append == 1)
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Append to"), formatstr, backupstr);
|
||||
else
|
||||
- i = statusq(1, writefile_list, answer, 0,
|
||||
+ i = statusq(1, writefile_list, writepath, 0,
|
||||
"%s%s%s", _("File Name to Write"), formatstr, backupstr);
|
||||
}
|
||||
#else
|
||||
if (append == 2)
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Prepend to"));
|
||||
else if (append == 1)
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Append to"));
|
||||
else
|
||||
- i = statusq(1, writefile_list, answer,
|
||||
+ i = statusq(1, writefile_list, writepath,
|
||||
"%s", _("File Name to Write"));
|
||||
#endif /* !NANO_SMALL */
|
||||
|
19
editors/nano/files/patch-search.c
Normal file
19
editors/nano/files/patch-search.c
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
$FreeBSD$
|
||||
|
||||
--- search.c.orig Sun Oct 5 02:38:32 2003
|
||||
+++ search.c Sun Oct 5 02:40:32 2003
|
||||
@@ -769,8 +769,12 @@
|
||||
|
||||
int do_gotoline(int line, int save_pos)
|
||||
{
|
||||
+ static char *linestr = NULL;
|
||||
+
|
||||
+ linestr = mallocstrcpy(linestr, answer);
|
||||
+
|
||||
if (line <= 0) { /* Ask for it */
|
||||
- int st = statusq(FALSE, goto_list, line != 0 ? answer : "",
|
||||
+ int st = statusq(FALSE, goto_list, line != 0 ? linestr : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user