[pkg-opensc-commit] [opensc] 211/295: Fix cases of log function format strings not being a string literal

Eric Dorland eric at moszumanska.debian.org
Sat Jun 24 21:11:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository opensc.

commit 58c4de26a729034059da4a2975ba6a37963d1517
Author: Maciej S. Szmigiero <mail at maciej.szmigiero.name>
Date:   Tue Mar 14 20:12:01 2017 +0100

    Fix cases of log function format strings not being a string literal
    
    Looks like Travis CI build server found a few cases of log function format
    string not being a string literal (now that log functions have necessary
    attributes to check for such things).
    Some instances clearly aren't a real problem, but to be future-proof and to
    avoid compiler warnings let's fix all of them (that I was able to find in
    code).
    
    Signed-off-by: Maciej S. Szmigiero <mail at maciej.szmigiero.name>
---
 src/libopensc/card-dnie.c   |  2 +-
 src/libopensc/card-mcrd.c   |  4 ++--
 src/libopensc/cwa-dnie.c    |  4 ++--
 src/libopensc/cwa14890.c    | 20 ++++++++++----------
 src/libopensc/reader-pcsc.c | 12 ++++++------
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/libopensc/card-dnie.c b/src/libopensc/card-dnie.c
index 6e790ef..76e9010 100644
--- a/src/libopensc/card-dnie.c
+++ b/src/libopensc/card-dnie.c
@@ -618,7 +618,7 @@ get_info_end:
 		bufferlen=0;
 	}
 	if (msg)
-		sc_log(card->ctx,msg);
+		sc_log(card->ctx, "%s", msg);
         LOG_FUNC_RETURN(card->ctx, res);
 }
 
diff --git a/src/libopensc/card-mcrd.c b/src/libopensc/card-mcrd.c
index 4186cb0..cbba3fd 100644
--- a/src/libopensc/card-mcrd.c
+++ b/src/libopensc/card-mcrd.c
@@ -1084,7 +1084,7 @@ mcrd_select_file(sc_card_t * card, const sc_path_t * path, sc_file_t ** file)
 			linep += 4;
 		}
 		strcpy(linep, "\n");
-		sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, line);
+		sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "%s", line);
 	}
 
 	if (path->type == SC_PATH_TYPE_DF_NAME) {
@@ -1147,7 +1147,7 @@ mcrd_select_file(sc_card_t * card, const sc_path_t * path, sc_file_t ** file)
 			linep += 4;
 		}
 		strcpy(linep, "\n");
-		sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, line);
+		sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "%s", line);
 	}
 	return r;
 }
diff --git a/src/libopensc/cwa-dnie.c b/src/libopensc/cwa-dnie.c
index 69d2665..3901905 100644
--- a/src/libopensc/cwa-dnie.c
+++ b/src/libopensc/cwa-dnie.c
@@ -349,7 +349,7 @@ int dnie_read_file(sc_card_t * card,
 	}
  dnie_read_file_end:
 	if (msg)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	LOG_FUNC_RETURN(ctx, res);
 }
 
@@ -398,7 +398,7 @@ static int dnie_read_certificate(sc_card_t * card, char *certpath, X509 ** cert)
 	sc_file_free(file);
 	file = NULL;
 	if (msg)
-		sc_log(card->ctx, msg);
+		sc_log(card->ctx, "%s", msg);
 	LOG_FUNC_RETURN(card->ctx, res);
 }
 
diff --git a/src/libopensc/cwa14890.c b/src/libopensc/cwa14890.c
index 2d5045d..1a6e17d 100644
--- a/src/libopensc/cwa14890.c
+++ b/src/libopensc/cwa14890.c
@@ -414,7 +414,7 @@ static int cwa_verify_icc_certificates(sc_card_t * card,
 	if (sub_ca_key)
 		EVP_PKEY_free(sub_ca_key);
 	if (res != SC_SUCCESS)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	LOG_FUNC_RETURN(ctx, res);
 }
 
@@ -707,7 +707,7 @@ static int cwa_prepare_external_auth(sc_card_t * card,
 	}
 
 	if (res != SC_SUCCESS)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	LOG_FUNC_RETURN(ctx, res);
 }
 
@@ -822,7 +822,7 @@ static int cwa_compute_session_keys(sc_card_t * card)
 		free(sha_data);
 	}
 	if (res != SC_SUCCESS)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	else {
 		sc_log(ctx, "Kenc: %s", sc_dump_hex(sm->session_enc, 16));
 		sc_log(ctx, "Kmac: %s", sc_dump_hex(sm->session_mac, 16));
@@ -1015,7 +1015,7 @@ static int cwa_verify_internal_auth(sc_card_t * card,
 	if (sigbn)
 		BN_free(sigbn);
 	if (res != SC_SUCCESS)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	LOG_FUNC_RETURN(ctx, res);
 }
 
@@ -1096,7 +1096,7 @@ int cwa_create_secure_channel(sc_card_t * card,
 		res = provider->cwa_create_pre_ops(card, provider);
 		if (res != SC_SUCCESS) {
 			msg = "Create SM: provider pre_ops() failed";
-			sc_log(ctx, msg);
+			sc_log(ctx, "%s", msg);
 			goto csc_end;
 		}
 	}
@@ -1107,12 +1107,12 @@ int cwa_create_secure_channel(sc_card_t * card,
 		res = provider->cwa_get_sn_icc(card);
 		if (res != SC_SUCCESS) {
 			msg = "Retrieve ICC failed";
-			sc_log(ctx, msg);
+			sc_log(ctx, "%s", msg);
 			goto csc_end;
 		}
 	} else {
 		msg = "Don't know how to obtain ICC serial number";
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 		res = SC_ERROR_INTERNAL;
 		goto csc_end;
 	}
@@ -1386,7 +1386,7 @@ int cwa_create_secure_channel(sc_card_t * card,
 		EVP_PKEY_free(ifd_privkey);
 	/* setup SM state according result */
 	if (res != SC_SUCCESS) {
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 		card->sm_ctx.sm_mode = SM_MODE_NONE;
 	} else {
 		card->sm_ctx.sm_mode = SM_MODE_TRANSMIT;
@@ -1593,7 +1593,7 @@ encode_end:
 		free(apdubuf);
 encode_end_apdu_valid:
 	if (msg)
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	free(msgbuf);
 	free(cryptbuf);
 	free(ccbuf);
@@ -1852,7 +1852,7 @@ int cwa_decode_response(sc_card_t * card,
 	if (ccbuf)
 		free(ccbuf);
 	if (msg) {
-		sc_log(ctx, msg);
+		sc_log(ctx, "%s", msg);
 	} else {
 		cwa_trace_apdu(card, apdu, 1);
 	}			/* trace apdu response */
diff --git a/src/libopensc/reader-pcsc.c b/src/libopensc/reader-pcsc.c
index d7bb6bc..149f529 100644
--- a/src/libopensc/reader-pcsc.c
+++ b/src/libopensc/reader-pcsc.c
@@ -1071,7 +1071,7 @@ static void detect_reader_features(sc_reader_t *reader, SCARDHANDLE card_handle)
 	if (priv->verify_ioctl || (priv->verify_ioctl_start && priv->verify_ioctl_finish)) {
 		const char *log_text = "Reader supports pinpad PIN verification";
 		if (priv->gpriv->enable_pinpad) {
-			sc_log(ctx, log_text);
+			sc_log(ctx, "%s", log_text);
 			reader->capabilities |= SC_READER_CAP_PIN_PAD;
 		} else {
 			sc_log(ctx, "%s %s", log_text, log_disabled);
@@ -1081,7 +1081,7 @@ static void detect_reader_features(sc_reader_t *reader, SCARDHANDLE card_handle)
 	if (priv->modify_ioctl || (priv->modify_ioctl_start && priv->modify_ioctl_finish)) {
 		const char *log_text = "Reader supports pinpad PIN modification";
 		if (priv->gpriv->enable_pinpad) {
-			sc_log(ctx, log_text);
+			sc_log(ctx, "%s", log_text);
 			reader->capabilities |= SC_READER_CAP_PIN_PAD;
 		} else {
 			sc_log(ctx, "%s %s", log_text, log_disabled);
@@ -1128,7 +1128,7 @@ static void detect_reader_features(sc_reader_t *reader, SCARDHANDLE card_handle)
 			reader->capabilities |= part10_detect_pace_capabilities(reader, card_handle);
 
 			if (reader->capabilities & SC_READER_CAP_PACE_GENERIC)
-				sc_log(ctx, log_text);
+				sc_log(ctx, "%s", log_text);
 		}
 		else {
 			sc_log(ctx, "%s %s", log_text, log_disabled);
@@ -2517,7 +2517,7 @@ int cardmod_use_reader(sc_context_t *ctx, void * pcsc_context_handle, void * pcs
 					if (priv->verify_ioctl || (priv->verify_ioctl_start && priv->verify_ioctl_finish)) {
 						char *log_text = "Reader supports pinpad PIN verification";
 						if (priv->gpriv->enable_pinpad) {
-							sc_log(ctx, log_text);
+							sc_log(ctx, "%s", log_text);
 							reader->capabilities |= SC_READER_CAP_PIN_PAD;
 						} else {
 							sc_log(ctx, "%s %s", log_text, log_disabled);
@@ -2527,7 +2527,7 @@ int cardmod_use_reader(sc_context_t *ctx, void * pcsc_context_handle, void * pcs
 					if (priv->modify_ioctl || (priv->modify_ioctl_start && priv->modify_ioctl_finish)) {
 						char *log_text = "Reader supports pinpad PIN modification";
 						if (priv->gpriv->enable_pinpad) {
-							sc_log(ctx, log_text);
+							sc_log(ctx, "%s", log_text);
 							reader->capabilities |= SC_READER_CAP_PIN_PAD;
 						} else {
 							sc_log(ctx, "%s %s", log_text, log_disabled);
@@ -2564,7 +2564,7 @@ int cardmod_use_reader(sc_context_t *ctx, void * pcsc_context_handle, void * pcs
 					if (priv->pace_ioctl) {
 						char *log_text = "Reader supports PACE";
 						if (priv->gpriv->enable_pace) {
-							sc_log(ctx, log_text);
+							sc_log(ctx, "%s", log_text);
 							reader->capabilities |= SC_READER_CAP_PACE_GENERIC;
 						} else {
 							sc_log(ctx, "%s %s", log_text, log_disabled);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git



More information about the pkg-opensc-commit mailing list