1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 16:38:29 +00:00

Do not use NULL for va_* variadic functions

This commit is contained in:
jsteube 2017-02-11 11:51:46 +01:00
parent fdbe6f8281
commit 06c184aeea
2 changed files with 90 additions and 37 deletions

View File

@ -120,7 +120,6 @@ VERSION_TAG := $(shell test -d .git && git describe --tags --dirty=+
##
CFLAGS += -pipe -std=c99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/
CFLAGS += -Wno-format-zero-length
ifeq ($(PRODUCTION),0)
CFLAGS += -W

View File

@ -67,16 +67,25 @@ static int event_log (const char *fmt, va_list ap, char *s, const size_t sz)
}
size_t event_log_info_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = false;
@ -86,16 +95,25 @@ size_t event_log_info_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
}
size_t event_log_warning_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = false;
@ -105,16 +123,25 @@ size_t event_log_warning_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
}
size_t event_log_error_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = false;
@ -124,16 +151,25 @@ size_t event_log_error_nn (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
}
size_t event_log_info (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = true;
@ -143,16 +179,25 @@ size_t event_log_info (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
}
size_t event_log_warning (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = true;
@ -162,16 +207,25 @@ size_t event_log_warning (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
}
size_t event_log_error (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
if (fmt == NULL)
{
event_ctx->msg_buf[0] = 0;
event_ctx->msg_len = 0;
}
else
{
va_list ap;
va_start (ap, fmt);
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
va_end (ap);
}
event_ctx->msg_newline = true;