Date: Tue, 4 Feb 2020 21:16:41 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357537 - head/contrib/elftoolchain/elfcopy Message-ID: <202002042116.014LGf9p019094@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Feb 4 21:16:41 2020 New Revision: 357537 URL: https://svnweb.freebsd.org/changeset/base/357537 Log: elfcopy: Handle multiple data descriptors properly. The code clearly meant to resize the buffer in the case where a section was backed by multiple data descriptors. In practice this shouldn't have been a problem since libelf would return a single data descriptor for each section in a newly opened file. CID: 1262522 MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/elfcopy/sections.c Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Tue Feb 4 21:16:16 2020 (r357536) +++ head/contrib/elftoolchain/elfcopy/sections.c Tue Feb 4 21:16:41 2020 (r357537) @@ -1137,7 +1137,7 @@ read_section(struct section *s, size_t *size) if (b == NULL) b = malloc(id->d_size); else - b = malloc(sz + id->d_size); + b = realloc(b, sz + id->d_size); if (b == NULL) err(EXIT_FAILURE, "malloc or realloc failed");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002042116.014LGf9p019094>