Bug 166278 - [patch] devel/libexecinfo: backtrace_symbols_fd() output some junk
Summary: [patch] devel/libexecinfo: backtrace_symbols_fd() output some junk
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: Ion-Mihai "IOnut" Tetcu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-20 17:40 UTC by Dmitrij Tejblum
Modified: 2012-08-12 11:00 UTC (History)
0 users

See Also:


Attachments
file.diff (368 bytes, patch)
2012-03-20 17:40 UTC, Dmitrij Tejblum
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitrij Tejblum 2012-03-20 17:40:07 UTC
The function backtrace_symbols_fd() in the libexecinfo library allocates some buffer and the fill it with snprintf(). snprintf() leaves unused some space at the end of the buffer. Then backtrace_symbols_fd() output the whole buffer; it result in junk in the output.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-03-20 17:40:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->itetcu

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-08-12 10:56:29 UTC
Author: itetcu
Date: Sun Aug 12 09:56:15 2012
New Revision: 302432
URL: http://svn.freebsd.org/changeset/ports/302432

Log:
  Output only the used part of the buffer in  backtrace_symbols_fd().
  
  PR:		166278
  Submitted by:	Dmitrij Tejblum

Modified:
  head/devel/libexecinfo/files/patch-execinfo.c   (contents, props changed)

Modified: head/devel/libexecinfo/files/patch-execinfo.c
==============================================================================
--- head/devel/libexecinfo/files/patch-execinfo.c	Sun Aug 12 09:36:30 2012	(r302431)
+++ head/devel/libexecinfo/files/patch-execinfo.c	Sun Aug 12 09:56:15 2012	(r302432)
@@ -54,3 +54,11 @@
      return rval;
  }
  
+@@ -155,6 +158,6 @@
+                 return;
+             snprintf(buf, len, "%p\n", buffer[i]);
+         }
+-        write(fd, buf, len - 1);
++        write(fd, buf, strlen(buf));
+     }
+ }
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Ion-Mihai "IOnut" Tetcu freebsd_committer freebsd_triage 2012-08-12 10:56:38 UTC
State Changed
From-To: open->closed

Committed. Thanks!