Date: Fri, 18 Mar 2005 01:42:01 GMT From: Douglas Thrift <douglas@douglasthrift.net> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/78972: Update port: devel/libexecinfo realloc problem fix Message-ID: <200503180142.j2I1g17D070942@www.freebsd.org> Resent-Message-ID: <200503180150.j2I1o2bv035930@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 78972 >Category: ports >Synopsis: Update port: devel/libexecinfo realloc problem fix >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Fri Mar 18 01:50:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Douglas Thrift >Release: 5.3-RELEASE >Organization: >Environment: FreeBSD daemon.douglasthrift.net 5.3-RELEASE-p2 FreeBSD 5.3-RELEASE-p2 #0: Tue Dec 28 22:10:37 PST 2004 douglas@daemon.douglasthrift.net:/usr/obj/usr/src/sys/DAEMONIC i386 >Description: As I understand it, libexecinfo was not correctly updating pointers after calls to realloc, this patch was written by Jay Freeman <saurik@saurik.com>. >How-To-Repeat: >Fix: diff -ruN /usr/ports/devel/libexecinfo/files/patch-execinfo.c ./libexecinfo/files/patch-execinfo.c --- /usr/ports/devel/libexecinfo/files/patch-execinfo.c Wed Dec 31 16:00:00 1969 +++ ./libexecinfo/files/patch-execinfo.c Wed Feb 9 17:00:15 2005 @@ -0,0 +1,45 @@ +--- execinfo.c.orig Sun Jul 18 22:21:09 2004 ++++ execinfo.c Wed Feb 9 16:56:51 2005 +@@ -78,7 +78,6 @@ + rval = malloc(clen); + if (rval == NULL) + return NULL; +- (char **)cp = &(rval[size]); + for (i = 0; i < size; i++) { + if (dladdr(buffer[i], &info) != 0) { + if (info.dli_sname == NULL) +@@ -92,14 +91,14 @@ + 2 + /* " <" */ + strlen(info.dli_sname) + /* "function" */ + 1 + /* "+" */ +- D10(offset) + /* "offset */ ++ 10 + /* "offset */ + 5 + /* "> at " */ + strlen(info.dli_fname) + /* "filename" */ + 1; /* "\0" */ + rval = realloc_safe(rval, clen + alen); + if (rval == NULL) + return NULL; +- snprintf(cp, alen, "%p <%s+%d> at %s", ++ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s", + buffer[i], info.dli_sname, offset, info.dli_fname); + } else { + alen = 2 + /* "0x" */ +@@ -108,11 +107,14 @@ + rval = realloc_safe(rval, clen + alen); + if (rval == NULL) + return NULL; +- snprintf(cp, alen, "%p", buffer[i]); ++ snprintf((char *) rval + clen, alen, "%p", buffer[i]); + } +- rval[i] = cp; +- cp += alen; ++ rval[i] = (char *) clen; ++ clen += alen; + } ++ ++ for (i = 0; i < size; i++) ++ rval[i] += (int) rval; + + return rval; + } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503180142.j2I1g17D070942>