From cd072a630de628b8b117efa93c814542270d5ebe Mon Sep 17 00:00:00 2001 From: bcook <> Date: Sat, 16 Aug 2014 18:47:40 +0000 Subject: replace sprintf/strdup with asprintf in engine test --- src/regress/lib/libcrypto/engine/enginetest.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/regress/lib/libcrypto/engine/enginetest.c b/src/regress/lib/libcrypto/engine/enginetest.c index 5032dc47e7..7a0b1a8751 100644 --- a/src/regress/lib/libcrypto/engine/enginetest.c +++ b/src/regress/lib/libcrypto/engine/enginetest.c @@ -95,8 +95,7 @@ static void display_engine_list(void) int main(int argc, char *argv[]) { ENGINE *block[512]; - char buf[256]; - const char *id, *name; + char *id, *name; ENGINE *ptr; int loop; int to_return = 1; @@ -207,13 +206,11 @@ int main(int argc, char *argv[]) printf("About to beef up the engine-type list\n"); for(loop = 0; loop < 512; loop++) { - sprintf(buf, "id%i", loop); - id = BUF_strdup(buf); - sprintf(buf, "Fake engine type %i", loop); - name = BUF_strdup(buf); + asprintf(&id, "id%i", loop); + asprintf(&name, "Fake engine type %i", loop); if(((block[loop] = ENGINE_new()) == NULL) || - !ENGINE_set_id(block[loop], id) || - !ENGINE_set_name(block[loop], name)) + !id || !ENGINE_set_id(block[loop], id) || + !name || !ENGINE_set_name(block[loop], name)) { printf("Couldn't create block of ENGINE structures.\n" "I'll probably also core-dump now, damn.\n"); -- cgit v1.2.3-55-g6feb