summaryrefslogtreecommitdiff
path: root/python/typelibrary.py
diff options
context:
space:
mode:
authorZerotistic <54184933+Zerotistic@users.noreply.github.com>2024-10-26 23:48:22 +0200
committergalenbwill <galenbwill@users.noreply.github.com>2024-10-30 18:13:23 -0400
commit1bb5a361c8cfab7b39692dec42e57514712503b1 (patch)
treef2f86ff25a8963d42379929fecc163c44fd6130d /python/typelibrary.py
parenta54125565bb32bfb8af86f9b3ab3cb2151d76a14 (diff)
fix: validate input type in TypeLibrary.add_alternate_name to prevent crashes
Fixes Vector35/binaryninja-api#5814. The function now checks if the input is of type . This prevents crashes caused by passing null or non-string values.
Diffstat (limited to 'python/typelibrary.py')
-rw-r--r--python/typelibrary.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/python/typelibrary.py b/python/typelibrary.py
index 724f8c5e..232cd6a0 100644
--- a/python/typelibrary.py
+++ b/python/typelibrary.py
@@ -183,6 +183,8 @@ class TypeLibrary:
def add_alternate_name(self, name: str) -> None:
"""Adds an extra name to this type library used during library lookups and dependency resolution"""
+ if type(name) != str:
+ raise ValueError(f"Expected name to be str, got {type(name)}")
core.BNAddTypeLibraryAlternateName(self.handle, name)
@property