From patchwork Wed Oct 18 15:38:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 23672 Received: (qmail 19997 invoked by alias); 18 Oct 2017 15:38:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 19988 invoked by uid 89); 18 Oct 2017 15:38:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Subject: [PATCH] powerpc: Fix error message during relocation overflow Date: Wed, 18 Oct 2017 13:38:24 -0200 X-TM-AS-GCONF: 00 x-cbid: 17101815-0052-0000-0000-00000273B0CC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007914; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000237; SDB=6.00932955; UDB=6.00469868; IPR=6.00713245; BA=6.00005647; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017593; XFM=3.00000015; UTC=2017-10-18 15:38:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101815-0053-0000-0000-0000525C2539 Message-Id: <20171018153824.24225-1-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-18_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710180215 The function _itoa_word() writes characters from the higher address to the lower address, requiring the destination string to reserve that size before calling it. 2017-10-18 Tulio Magno Quites Machado Filho * sysdeps/powerpc/powerpc64/dl-machine.c (_dl_reloc_overflow): Reserve 16 chars to reloc_addr before calling _itoa_word. Signed-off-by: Tulio Magno Quites Machado Filho Reviewed-by: Adhemerval Zanella --- sysdeps/powerpc/powerpc64/dl-machine.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysdeps/powerpc/powerpc64/dl-machine.c b/sysdeps/powerpc/powerpc64/dl-machine.c index 2cfd43b..4c1b556 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.c +++ b/sysdeps/powerpc/powerpc64/dl-machine.c @@ -31,7 +31,10 @@ _dl_reloc_overflow (struct link_map *map, char buffer[1024]; char *t; t = stpcpy (buffer, name); - t = stpcpy (t, " reloc at 0x"); + /* Notice that _itoa_word() writes characters from the higher address to the + lower address, requiring the destination string to reserve all the + required size before the call. */ + t = stpcpy (t, " reloc at 0x0000000000000000"); _itoa_word ((unsigned long) reloc_addr, t, 16, 0); if (refsym) {