d747d1a8fe
- tests: Fix formatting and snprintf warnings in tests. (bcl) - ui: Add checks for prompt being NULL (bcl) - strlist: Handle realloc error in wchar_to_str (bcl) - libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl) - filesys: Check for null from close_fn (bcl)
29 lines
775 B
Diff
29 lines
775 B
Diff
From 9cb38a7444d02023d112ae8e9e38436104f75f64 Mon Sep 17 00:00:00 2001
|
|
From: "Brian C. Lane" <bcl@redhat.com>
|
|
Date: Wed, 15 Feb 2023 10:32:59 -0800
|
|
Subject: [PATCH 20/24] strlist: Handle realloc error in wchar_to_str
|
|
|
|
It could return a NULL if the realloc fails. This handles the failure in
|
|
the same way as other failures in wchar_to_str, it exits immediately
|
|
with an error message.
|
|
---
|
|
parted/strlist.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/parted/strlist.c b/parted/strlist.c
|
|
index 71cba59..7901789 100644
|
|
--- a/parted/strlist.c
|
|
+++ b/parted/strlist.c
|
|
@@ -166,6 +166,8 @@ wchar_to_str (const wchar_t* str, size_t count)
|
|
goto error;
|
|
|
|
result = realloc (result, strlen (result) + 1);
|
|
+ if (!result)
|
|
+ goto error;
|
|
return result;
|
|
|
|
error:
|
|
--
|
|
2.39.2
|
|
|