[PATCH] Initialize variables to prevent uninitialized use in libctf.
Frederic Cambus
fred@statdns.com
Tue Feb 2 09:55:42 GMT 2021
libctf/ChangeLog:
* ctf-create.c (ctf_serialize): Initialize 'err' to zero to
prevent uninitialized use.
* ctf-lookup.c (refresh_pptrtab): Initialize 'updated' to zero
to prevent uninitialized use.
---
libctf/ChangeLog | 7 +++++++
libctf/ctf-create.c | 2 +-
libctf/ctf-lookup.c | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 3a7f6ab1ce..82e696335d 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,10 @@
+2021-02-02 Frederic Cambus <fred@statdns.com>
+
+ * ctf-create.c (ctf_serialize): Initialize 'err' to zero to
+ prevent uninitialized use.
+ * ctf-lookup.c (refresh_pptrtab): Initialize 'updated' to zero
+ to prevent uninitialized use.
+
2021-01-19 Nick Alcock <nick.alcock@oracle.com>
* ctf-create.c (membadd): Transform ""-named members into
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index 50f48eb1bb..7d5dac5e69 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -688,7 +688,7 @@ ctf_serialize (ctf_dict_t *fp)
size_t ndynsyms = 0;
const char **sym_name_order = NULL;
unsigned char *buf = NULL, *newbuf;
- int err;
+ int err = 0;
if (!(fp->ctf_flags & LCTF_RDWR))
return (ctf_set_errno (fp, ECTF_RDONLY));
diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 6d4e085838..d80247d8bd 100644
--- a/libctf/ctf-lookup.c
+++ b/libctf/ctf-lookup.c
@@ -51,7 +51,7 @@ refresh_pptrtab (ctf_dict_t *fp, ctf_dict_t *pfp)
{
ctf_id_t type = LCTF_INDEX_TO_TYPE (fp, i, 1);
ctf_id_t reffed_type;
- int updated;
+ int updated = 0;
if (ctf_type_kind (fp, type) != CTF_K_POINTER)
continue;
--
2.29.2
More information about the Binutils
mailing list