Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Mar 2012 17:33:23 GMT
From:      Dmitrij Tejblum <tejblum@yandex-team.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/166278: [patch] devel/libexecinfo: backtrace_symbols_fd() output some junk
Message-ID:  <201203201733.q2KHXN9e058493@red.freebsd.org>
Resent-Message-ID: <201203201740.q2KHe8NY074242@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         166278
>Category:       ports
>Synopsis:       [patch] devel/libexecinfo: backtrace_symbols_fd() output some junk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 20 17:40:07 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Dmitrij Tejblum
>Release:        FreeBSD 8.2-STABLE
>Organization:
Yandex
>Environment:
>Description:
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.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- files/patch-execinfo.c	2008-11-26 18:23:25.000000000 +0300
+++ files/patch-execinfo.c	2012-03-20 21:07:56.000000000 +0400
@@ -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));
+     }
+ }


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203201733.q2KHXN9e058493>