From bb51cb3e14025cd8680cf5d93d36510c8e3d0f45 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Sun, 7 Jan 2018 18:10:43 +0200 Subject: [PATCH] remove additional zero byte when writing pub der Remove `- 1` for setting location of output buffer, which added a leading zero which cause failure in ASN1 parsing. Fixes #1257 --- programs/pkey/key_app_writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index 9d120772a..b273e7daa 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -128,7 +128,7 @@ static int write_public_key( mbedtls_pk_context *key, const char *output_file ) return( ret ); len = ret; - c = output_buf + sizeof(output_buf) - len - 1; + c = output_buf + sizeof(output_buf) - len; } if( ( f = fopen( output_file, "w" ) ) == NULL )