From ce32fd33f04c55c33eefcd21eeb3661c8af347c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Fri, 4 Oct 2002 16:32:44 +0200
Subject: [PATCH] Use malloc, instead of asprintf.

Rev: src/nettle/examples/rsa-keygen.c:1.7
---
 examples/rsa-keygen.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/examples/rsa-keygen.c b/examples/rsa-keygen.c
index fc4176c3..6b683cd3 100644
--- a/examples/rsa-keygen.c
+++ b/examples/rsa-keygen.c
@@ -22,9 +22,6 @@
  * MA 02111-1307, USA.
  */
 
-/* For asprintf */
-#define _GNU_SOURCE
-
 #include "buffer.h"
 #include "rsa.h"
 #include "sexp.h"
@@ -95,13 +92,16 @@ main(int argc, char **argv)
       return EXIT_FAILURE;
     }
 
-  asprintf(&pub_name, "%s.pub", priv_name);
-  if (!pub_name)
+  pub_name = malloc(strlen(priv_name) + 5);  
+
+  if (pub_name)
+    sprintf(pub_name, "%s.pub", priv_name);
+  else
     {
       werror("Memory exhausted.\n");
       return EXIT_FAILURE;
     }
-  
+
   /* NOTE: No sources */
   yarrow256_init(&yarrow, 0, NULL);
 
-- 
GitLab