Set len to buffer size.
diff --git a/apps/dgst.c b/apps/dgst.c
index 312d880..7e79868 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -593,6 +593,7 @@
 		{
 		EVP_MD_CTX *ctx;
 		BIO_get_md_ctx(bp, &ctx);
+		len = BUFSIZE;
 		if(!EVP_DigestSignFinal(ctx, buf, &len)) 
 			{
 			BIO_printf(bio_err, "Error Signing Data\n");