[PATCH] Fix null pointer dereference vulnerability in pv_dup function
pengxu@kylinos.cn
pengxu@kylinos.cn
Fri Mar 27 07:36:26 GMT 2026
From: pengxu2024 <pengxu@kylinos.cn>
---
opcodes/opc2c.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/opcodes/opc2c.c b/opcodes/opc2c.c
index 5e5fba67add..f66877fbcc4 100644
--- a/opcodes/opc2c.c
+++ b/opcodes/opc2c.c
@@ -462,6 +462,8 @@ pv_dup (char * p, char * ep)
{
int n = ep - p;
char *rv = (char *) malloc (n + 1);
+ if (rv == NULL)
+ return NULL;
memcpy (rv, p, n);
rv[n] = 0;
--
2.25.1
More information about the Binutils
mailing list