1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

coverity: fixes

This commit is contained in:
Andy Green 2022-03-16 16:42:36 +00:00
parent b0041b32e6
commit 76d8840c5f
3 changed files with 13 additions and 7 deletions

View file

@ -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,

View file

@ -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;

View file

@ -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