Skip to contentSkip to conversation

ubsan: Remove 1-element array usage in debug reporting

PATCH In review Kees Cook 2 participants 2 messages Apr 24, 2024

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 ubsan: Remove 1-element array usage in debug reporting

The "type_name" character array was still marked as a 1-element array. While we don't validate strings used in format arguments yet, let's fix this before it causes trouble some future day.

---
Cc: Gustavo A. R. Silva <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: Andrey Konovalov <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 lib/ubsan.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/ubsan.h +1 -1
index 0abbbac8700d..50ef50811b7c 100644
@@ -43,7 +43,7 @@ enum {
 struct type_descriptor {
 	u16 type_kind;
 	u16 type_info;
-	char type_name[1];
+	char type_name[];
 };
 
 struct source_location {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Kees Cook

The "type_name" character array was still marked as a 1-element array. While we don't validate strings used in format arguments yet, let's fix this before it causes trouble some future day.

Thanks!
--
Gustavo

Quoted 24 lines

---
Cc: Gustavo A. R. Silva <[email protected]>
Cc: Marco Elver <[email protected]>
Cc: Andrey Konovalov <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  lib/ubsan.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
lib/ubsan.h +1 -1
index 0abbbac8700d..50ef50811b7c 100644
@@ -43,7 +43,7 @@ enum {
  struct type_descriptor {
  	u16 type_kind;
  	u16 type_info;
-	char type_name[1];
+	char type_name[];
  };
 
  struct source_location {