summaryrefslogtreecommitdiff
path: root/usr.bin/cdio
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cdio')
-rw-r--r--usr.bin/cdio/cddb.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/cdio/cddb.c b/usr.bin/cdio/cddb.c
index 89a6ea9c0df..9ea17188f55 100644
--- a/usr.bin/cdio/cddb.c
+++ b/usr.bin/cdio/cddb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cddb.c,v 1.8 2003/06/09 11:33:14 espie Exp $ */
+/* $OpenBSD: cddb.c,v 1.9 2005/11/12 15:26:23 deraadt Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
@@ -106,11 +106,10 @@ safe_copy(char **p, const char *title)
if (*p == NULL)
*p = strdup(copy_buffer);
else {
- size_t len = strlen(*p) + strlen(copy_buffer) + 1;
- char *n = malloc(len);
- if (n == NULL)
+ char *n;
+
+ if (asprintf(&n, "%s%s", *p, copy_buffer) == -1)
return;
- snprintf(n, len, "%s%s", *p, copy_buffer);
free(*p);
*p = n;
}