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:
parent
fdbe6f8281
commit
06c184aeea
@ -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
|
||||
|
126
src/event.c
126
src/event.c
@ -68,15 +68,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = false;
|
||||
|
||||
@ -87,15 +96,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = false;
|
||||
|
||||
@ -106,15 +124,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = false;
|
||||
|
||||
@ -125,15 +152,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = true;
|
||||
|
||||
@ -144,15 +180,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = true;
|
||||
|
||||
@ -163,15 +208,24 @@ 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, ...)
|
||||
{
|
||||
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);
|
||||
if (fmt == NULL)
|
||||
{
|
||||
event_ctx->msg_buf[0] = 0;
|
||||
|
||||
va_end (ap);
|
||||
event_ctx->msg_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
event_ctx->msg_len = event_log (fmt, ap, event_ctx->msg_buf, HCBUFSIZ_TINY - 1);
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
event_ctx->msg_newline = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user