* [Bug general/23320] New: Incorrect usage of sizeof @ 2018-06-20 17:13 serban at us dot ibm.com 2018-06-20 20:12 ` [Bug general/23320] " mark at klomp dot org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: serban at us dot ibm.com @ 2018-06-20 17:13 UTC (permalink / raw) To: elfutils-devel https://sourceware.org/bugzilla/show_bug.cgi?id=23320 Bug ID: 23320 Summary: Incorrect usage of sizeof Product: elfutils Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: general Assignee: unassigned at sourceware dot org Reporter: serban at us dot ibm.com CC: elfutils-devel at sourceware dot org Target Milestone: --- The following diff show the incorrect usages of the sizeof routine: --> git diff src/ar.c src/nm.c src/readelf.c diff --git a/src/ar.c b/src/ar.c index bfb324c..58c8b11 100644 --- a/src/ar.c +++ b/src/ar.c @@ -919,7 +919,7 @@ do_oper_delete (const char *arfname, char **argv, int argc, long int instance) { bool *found = alloca (sizeof (bool) * argc); - memset (found, '\0', sizeof (found)); + memset (found, '\0', sizeof (bool) * argc); /* List of the files we keep. */ struct armem *to_copy = NULL; diff --git a/src/nm.c b/src/nm.c index f78861e..6c86298 100644 --- a/src/nm.c +++ b/src/nm.c @@ -752,7 +752,7 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname, if (unlikely (name == NULL)) { name = alloca (sizeof "[invalid sh_name 0x12345678]"); - snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]", + snprintf (name, sizeof "[invalid sh_name 0x12345678]", "[invalid sh_name %#" PRIx32 "]", gelf_getshdr (scn, &shdr_mem)->sh_name); } scnnames[elf_ndxscn (scn)] = name; diff --git a/src/readelf.c b/src/readelf.c index 4032bd4..69b2abb 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -4787,7 +4787,7 @@ register_info (Ebl *ebl, unsigned int regno, const Ebl_Register_Location *loc, bits ?: &ignore, type ?: &ignore); if (n <= 0) { - snprintf (name, sizeof name, "reg%u", loc->regno); + snprintf (name, REGNAMESZ, "reg%u", loc->regno); if (bits != NULL) *bits = loc->bits; if (type != NULL) -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug general/23320] Incorrect usage of sizeof 2018-06-20 17:13 [Bug general/23320] New: Incorrect usage of sizeof serban at us dot ibm.com @ 2018-06-20 20:12 ` mark at klomp dot org 2018-06-20 21:12 ` serban at us dot ibm.com 2018-06-20 21:21 ` mark at klomp dot org 2 siblings, 0 replies; 4+ messages in thread From: mark at klomp dot org @ 2018-06-20 20:12 UTC (permalink / raw) To: elfutils-devel https://sourceware.org/bugzilla/show_bug.cgi?id=23320 Mark Wielaard <mark at klomp dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at klomp dot org --- Comment #1 from Mark Wielaard <mark at klomp dot org> --- Thanks, but I believe you are using an old version of elfutils. In the current code these bugs have already been fixed by: commit 1a4d0668d18bf1090c5c08cdb5cb3ba2b8eb5410 Author: David Abdurachmanov <David.Abdurachmanov@cern.ch> Date: Sun Jan 13 16:44:21 2013 +0100 ar.c (do_oper_delete): Fix num passed to memset. Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch> commit 57bd66cabf6e6b9ecf622cdbf350804897a8df58 Author: Roland McGrath <roland@hack.frob.com> Date: Tue Dec 11 09:42:07 2012 -0800 nm: Fix size passed to snprintf for invalid sh_name case. Signed-off-by: Roland McGrath <roland@hack.frob.com> commit 8d1e297a883c35eae53914a1739fdf0bfb590a6e Author: Marek Polacek <mpolacek@redhat.com> Date: Tue Oct 4 05:11:42 2011 -0400 readelf.c: Assume the right size of an array -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug general/23320] Incorrect usage of sizeof 2018-06-20 17:13 [Bug general/23320] New: Incorrect usage of sizeof serban at us dot ibm.com 2018-06-20 20:12 ` [Bug general/23320] " mark at klomp dot org @ 2018-06-20 21:12 ` serban at us dot ibm.com 2018-06-20 21:21 ` mark at klomp dot org 2 siblings, 0 replies; 4+ messages in thread From: serban at us dot ibm.com @ 2018-06-20 21:12 UTC (permalink / raw) To: elfutils-devel https://sourceware.org/bugzilla/show_bug.cgi?id=23320 --- Comment #2 from serban at us dot ibm.com --- Darn, yes, I cloned from another fork, don't know how. I re-cloned from upstream and it build w/no problems now. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug general/23320] Incorrect usage of sizeof 2018-06-20 17:13 [Bug general/23320] New: Incorrect usage of sizeof serban at us dot ibm.com 2018-06-20 20:12 ` [Bug general/23320] " mark at klomp dot org 2018-06-20 21:12 ` serban at us dot ibm.com @ 2018-06-20 21:21 ` mark at klomp dot org 2 siblings, 0 replies; 4+ messages in thread From: mark at klomp dot org @ 2018-06-20 21:21 UTC (permalink / raw) To: elfutils-devel https://sourceware.org/bugzilla/show_bug.cgi?id=23320 Mark Wielaard <mark at klomp dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #3 from Mark Wielaard <mark at klomp dot org> --- No worries, the issues were real. Just already solved. -- You are receiving this mail because: You are on the CC list for the bug. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-20 21:21 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-06-20 17:13 [Bug general/23320] New: Incorrect usage of sizeof serban at us dot ibm.com 2018-06-20 20:12 ` [Bug general/23320] " mark at klomp dot org 2018-06-20 21:12 ` serban at us dot ibm.com 2018-06-20 21:21 ` mark at klomp dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).