diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index 1b2d58873..9578920c7 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -1936,7 +1936,8 @@ lws_fx_string(const lws_fx_t *a, char *buf, size_t size) int n, m = 7; if (lws_neg(a)) - n = lws_snprintf(buf, size - 1, "-%d.%08d", (int)-a->whole, + n = lws_snprintf(buf, size - 1, "-%d.%08d", + (int)(a->whole < 0 ? -a->whole : a->whole), (int)(a->frac < 0 ? -a->frac : a->frac)); else n = lws_snprintf(buf, size - 1, "%d.%08d", (int)a->whole, diff --git a/lib/misc/lwsac/lwsac.c b/lib/misc/lwsac/lwsac.c index faa82f067..0f4ef1010 100644 --- a/lib/misc/lwsac/lwsac.c +++ b/lib/misc/lwsac/lwsac.c @@ -146,7 +146,7 @@ _lwsac_use(struct lwsac **head, size_t ensure, size_t chunk_size, char backfill) if (al >= alloc - hp) alloc = al + hp; - lwsl_debug("%s: alloc %d for %d\n", __func__, (int)alloc, (int)ensure); +// lwsl_debug("%s: alloc %d for %d\n", __func__, (int)alloc, (int)ensure); bf = malloc(alloc); if (!bf) { lwsl_err("%s: OOM trying to alloc %llud\n", __func__, @@ -264,7 +264,7 @@ lwsac_free(struct lwsac **head) struct lwsac *it = *head; *head = NULL; - lwsl_debug("%s: head %p\n", __func__, *head); + // lwsl_debug("%s: head %p\n", __func__, *head); while (it) { struct lwsac *tmp = it->next; diff --git a/lib/plat/unix/unix-init.c b/lib/plat/unix/unix-init.c index dac085bdb..6d3156c08 100644 --- a/lib/plat/unix/unix-init.c +++ b/lib/plat/unix/unix-init.c @@ -178,15 +178,20 @@ lws_plat_init(struct lws_context *context, return 1; } -#if defined(LWS_HAVE_SSL_CTX_set_keylog_callback) && \ +#if defined(LWS_HAVE_SSL_CTX_set_keylog_callback) && !defined(__COVERITY__) && \ defined(LWS_WITH_TLS) && defined(LWS_WITH_CLIENT) { char *klf_env = getenv("SSLKEYLOGFILE"); + size_t n = 0; - if (klf_env && strlen(klf_env) && strlen(klf_env) < sizeof(context->keylog_file)) { - lws_strncpy(context->keylog_file, klf_env, - sizeof(context->keylog_file)); + /* ... coverity taint with lws_strncpy()... */ + + while (klf_env && klf_env[n] && + n < sizeof(context->keylog_file) - 1) { + context->keylog_file[n] = klf_env[n]; + n++; } + context->keylog_file[n] = '\0'; } #endif