Bug 138320 - [patch] editors/nano segfaults on 8.0
Summary: [patch] editors/nano segfaults on 8.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Christian Weisgerber
Depends on:
Reported: 2009-08-30 00:50 UTC by Andrew Brampton
Modified: 2009-10-04 20:50 UTC (History)
0 users

See Also:

file.diff (289 bytes, patch)
2009-08-30 00:50 UTC, Andrew Brampton
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Brampton 2009-08-30 00:50:00 UTC
The port editor/nano segfaults on 8.0, when run:

> nano
Segmentation fault: 11 (core dumped)

I tracked this down to line 617 of rcfile.c where getline is called with an uninitalised argument. The fix is to initalise n to zero on a few lines above. The attached patch should fix this. I am also reporting this problem upstream.

Fix: Recompile with the attached patch, or run nano with the --ignorercfiles argument.

Patch attached with submission follows:
How-To-Repeat: Run nano with no arguments.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-08-30 04:51:28 UTC
Responsible Changed
From-To: freebsd-ports-bugs->naddy

Fix synopsis and assign.
Comment 2 dfilter service freebsd_committer 2009-08-30 16:26:57 UTC
naddy       2009-08-30 15:26:48 UTC

  FreeBSD ports repository

  Modified files:
    editors/nano         Makefile 
  Added files:
    editors/nano/files   patch-src_rcfile.c 
  Fix segfault on 8.0.
  PR:             138320
  Submitted by:   Andrew Brampton <brampton@gmail.com>
  Revision  Changes    Path
  1.49      +1 -0      ports/editors/nano/Makefile
  1.1       +14 -0     ports/editors/nano/files/patch-src_rcfile.c (new)
cvs-all@freebsd.org mailing list
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Christian Weisgerber freebsd_committer 2009-08-30 16:27:09 UTC
State Changed
From-To: open->closed

Committed, thanks.
Comment 4 dfilter service freebsd_committer 2009-10-04 20:43:51 UTC
Author: das
Date: Sun Oct  4 19:43:36 2009
New Revision: 197752
URL: http://svn.freebsd.org/changeset/base/197752

  Better glibc compatibility for getline/getdelim:
  - Tolerate applications that pass a NULL pointer for the buffer and
    claim that the capacity of the buffer is nonzero.
  - If an application passes in a non-NULL buffer pointer and claims the
    buffer has zero capacity, we should free (well, realloc) it
    anyway. It could have been obtained from malloc(0), so failing to
    free it would be a small memory leak.
  MFC After:	2 weeks
  Reported by:	naddy
  PR:		ports/138320


Modified: head/lib/libc/stdio/getdelim.c
--- head/lib/libc/stdio/getdelim.c	Sun Oct  4 19:03:32 2009	(r197751)
+++ head/lib/libc/stdio/getdelim.c	Sun Oct  4 19:43:36 2009	(r197752)
@@ -120,8 +120,8 @@ getdelim(char ** __restrict linep, size_
 		goto error;
-	if (*linecapp == 0)
-		*linep = NULL;
+	if (*linep == NULL)
+		*linecapp = 0;
 	if (fp->_r <= 0 && __srefill(fp)) {
 		/* If fp is at EOF already, we just need space for the NUL. */
svn-src-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"