master hovercats/oakiss / pkg / binutils / patch / 0005-libiberty-use-vasprintf-to-implement-xvasprintf.patch
 1From 69576e75720d7a1c847791c575df2ec7f97495a7 Mon Sep 17 00:00:00 2001
 2From: Michael Forney <mforney@mforney.org>
 3Date: Wed, 29 Apr 2026 18:20:37 -0700
 4Subject: [PATCH] libiberty: use vasprintf to implement xvasprintf
 5
 6---
 7 libiberty/xvasprintf.c | 5 ++---
 8 1 file changed, 2 insertions(+), 3 deletions(-)
 9
10diff --git a/libiberty/xvasprintf.c b/libiberty/xvasprintf.c
11index 3f022d1814b..26eaa6a25ff 100644
12--- a/libiberty/xvasprintf.c
13+++ b/libiberty/xvasprintf.c
14@@ -54,8 +54,7 @@ xvasprintf (const char *format,
15 #endif
16 {
17   char *result;
18-  int total_width = libiberty_vprintf_buffer_size (format, args);
19-  result = (char *) xmalloc (total_width);
20-  vsprintf (result, format, args);
21+  if (vasprintf (&result, format, args) < 0)
22+    xmalloc_failed (0);
23   return result;
24 }
25-- 
262.49.0
27