From 7170b990d3dc3974b8e670b3c0e4ca6dcc20c853 Mon Sep 17 00:00:00 2001
From: xiezhipeng <xiezhipeng1@huawei.com>
Date: Wed, 8 Dec 2021 09:47:36 +0800
Subject: [PATCH] fix segfault in eu-ar -m

Fix segfaultineu-ar-m.

---
 src/ar.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/ar.c b/src/ar.c
index ab6098f..ed5fe2f 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -1159,6 +1159,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
 	goto next;
 
       struct armem *newp = alloca (sizeof (struct armem));
+      memset (newp, '\0', sizeof(struct armem));
       newp->old_off = elf_getaroff (subelf);
       newp->size = arhdr->ar_size;
       newp->sec = arhdr->ar_date;
@@ -1251,6 +1252,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
 	  if (found[cnt] == NULL)
 	    {
 	      found[cnt] = alloca (sizeof (struct armem));
+              memset (found[cnt], '\0', sizeof(struct armem));
 	      found[cnt]->old_off = -1;
 
 	      remember_long_name (found[cnt], bname, bnamelen);
-- 
2.27.0

