The newly installed element may contain junk data in the name_hash_next
field. If it does, it will corrupt the hash table. Thus name_hash_next
field should be set to NULL when the element is installed successfully
into the hash table.

Signed-off-by: Tao Liu <[email protected]>
Reviewed-by: Philipp Rudo <[email protected]>
---
 symbols.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/symbols.c b/symbols.c
index 7ab47f2..f7157b1 100644
--- a/symbols.c
+++ b/symbols.c
@@ -1164,6 +1164,7 @@ symname_hash_install(struct syment *table[], struct 
syment *spn)
 
        if ((sp = table[index]) == NULL) {
                table[index] = spn;
+               spn->name_hash_next = NULL;
        } else {
                while (sp) {
                        if (STREQ(sp->name, spn->name)) {
@@ -1174,6 +1175,7 @@ symname_hash_install(struct syment *table[], struct 
syment *spn)
                                sp = sp->name_hash_next;
                        else {
                                sp->name_hash_next = spn;
+                               spn->name_hash_next = NULL;
                                break;
                        }
                }
-- 
2.29.2

--
Crash-utility mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/crash-utility

Reply via email to