From 079e384e3438a23d2ddc504f4d34e5a46d9dd6e8 Mon Sep 17 00:00:00 2001 From: doug <> Date: Fri, 3 Oct 2014 06:02:38 +0000 Subject: Use string literals in printf style calls so gcc's -Wformat works. ok tedu@, miod@ --- src/lib/libcrypto/asn1/asn1_par.c | 5 ++--- src/lib/libcrypto/ocsp/ocsp_ht.c | 12 ++++-------- src/lib/libcrypto/ui/ui_lib.c | 16 ++++++++++------ 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/lib/libcrypto') diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c index f5e3a8b529..2c8062bb8a 100644 --- a/src/lib/libcrypto/asn1/asn1_par.c +++ b/src/lib/libcrypto/asn1/asn1_par.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */ +/* $OpenBSD: asn1_par.c,v 1.21 2014/10/03 06:02:38 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -71,7 +71,6 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, int indent) { - static const char fmt[] = "%-18s"; char str[128]; const char *p; @@ -95,7 +94,7 @@ asn1_print_info(BIO *bp, int tag, int xclass, int constructed, else p = ASN1_tag2str(tag); - if (BIO_printf(bp, fmt, p) <= 0) + if (BIO_printf(bp, "%-18s", p) <= 0) goto err; return (1); err: diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index 5d1627192c..4d21543396 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ +/* $OpenBSD: ocsp_ht.c,v 1.22 2014/10/03 06:02:38 doug Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -119,11 +119,8 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) { - static const char req_hdr[] = - "Content-Type: application/ocsp-request\r\n" - "Content-Length: %d\r\n\r\n"; - - if (BIO_printf(rctx->mem, req_hdr, i2d_OCSP_REQUEST(req, NULL)) <= 0) + if (BIO_printf(rctx->mem, "Content-Type: application/ocsp-request\r\n" + "Content-Length: %d\r\n\r\n", i2d_OCSP_REQUEST(req, NULL)) <= 0) return 0; if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0) return 0; @@ -154,7 +151,6 @@ OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name, OCSP_REQ_CTX * OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) { - static const char post_hdr[] = "POST %s HTTP/1.0\r\n"; OCSP_REQ_CTX *rctx; rctx = malloc(sizeof(OCSP_REQ_CTX)); @@ -177,7 +173,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) if (!path) path = "/"; - if (BIO_printf(rctx->mem, post_hdr, path) <= 0) { + if (BIO_printf(rctx->mem, "POST %s HTTP/1.0\r\n", path) <= 0) { free(rctx->iobuf); BIO_free(rctx->mem); free(rctx); diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index baf86d7635..2c53f534e7 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ui_lib.c,v 1.28 2014/07/22 02:21:20 beck Exp $ */ +/* $OpenBSD: ui_lib.c,v 1.29 2014/10/03 06:02:38 doug Exp $ */ /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL * project 2001. */ @@ -386,7 +386,6 @@ UI_dup_error_string(UI *ui, const char *text) char * UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) { - const char *format = "Enter %s for %s:"; char *prompt; if (ui->meth->ui_construct_prompt) @@ -395,10 +394,15 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) if (object_desc == NULL) return NULL; - if (object_name == NULL) - format = "Enter %s:"; - if (asprintf(&prompt, format, object_desc, object_name) == -1) - return NULL; + + if (object_name == NULL) { + if (asprintf(&prompt, "Enter %s:", object_desc) == -1) + return (NULL); + } else { + if (asprintf(&prompt, "Enter %s for %s:", object_desc, + object_name) == -1) + return (NULL); + } return prompt; } -- cgit v1.2.3-55-g6feb