[PATCH v4 3/4] Set name_hash_next field to be NULL for the newly installed elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ltao@xxxxxxxxxx>
Reviewed-by: Philipp Rudo <prudo@xxxxxxxxxx>
---
 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
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux