From a6e8919728998f4aa2490d8e7b3342e2d27f10fd Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Thu, 25 Apr 2013 21:29:37 -0400 Subject: [PATCH 1/2] [server] fix minor CLANG static analyzer bugs These are simple logic fixes that would not have impacted run time to address the following warnings generated by the CLANG static analyzer: incoming_spa.c:433:17: warning: Value stored to 'attempted_decrypt' is never read attempted_decrypt = 1; ^ ~ incoming_spa.c:647:13: warning: Value stored to 'acc' is never read acc = acc->next; ^ ~~~~~~~~~ --- server/incoming_spa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/incoming_spa.c b/server/incoming_spa.c index 11ef13f3..9d05e91d 100644 --- a/server/incoming_spa.c +++ b/server/incoming_spa.c @@ -430,7 +430,7 @@ incoming_spa(fko_srv_options_t *opts) res = fko_new_with_data(&ctx, (char *)spa_pkt->packet_data, NULL, 0, FKO_ENC_MODE_ASYMMETRIC, acc->hmac_key, acc->hmac_key_len, acc->hmac_type); - attempted_decrypt = 1; + if(res != FKO_SUCCESS) { log_msg(LOG_WARNING, @@ -644,7 +644,6 @@ incoming_spa(fko_srv_options_t *opts) if(ctx != NULL) fko_destroy(ctx); - acc = acc->next; break; } From 0ec547e04d5bfda5558051eab719e8e7e4f88fcf Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Thu, 25 Apr 2013 21:32:02 -0400 Subject: [PATCH 2/2] [server] another minor CLANG static analyzer fix --- server/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils.c b/server/utils.c index 3a6e2ffd..1109ff34 100644 --- a/server/utils.c +++ b/server/utils.c @@ -159,7 +159,7 @@ dump_ctx(fko_ctx_t ctx) ndx += cp; cp = sprintf(ndx, "SPA Data Digest: %s\n", spa_digest == NULL ? "" : spa_digest); ndx += cp; - cp = sprintf(ndx, " HMAC: %s\n", hmac_data == NULL ? "" : hmac_data); + sprintf(ndx, " HMAC: %s\n", hmac_data == NULL ? "" : hmac_data); return(buf); }