Skip to contentSkip to conversation

rt_names: do not write past the end of the name tables

PATCH New Dave Seddon 1 participant 1 message Nov 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt_names: do not write past the end of the name tables

rtnl_tab_initialize() accepts id == size, so an id of 256 in rt_protos, rt_scopes, rt_realms, rt_dsfield or rt_addrprotos writes one entry past the 256-entry table. Use >=.

Assisted-by Claude:claude-opus-5-5
---
 lib/rt_names.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/rt_names.c +1 -1
index 3dba9642..97f520ff 100644
@@ -115,7 +115,7 @@ static int rtnl_tab_initialize(const char *file, char **tab, int size)
 			fclose(fp);
 			return -EINVAL;
 		}
-		if (id < 0 || id > size)
+		if (id < 0 || id >= size)
 			continue;
 
 		tab[id] = strdup(namebuf);
Signature · 1 line
2.56.0