krb5 commit: Add null check to placate static analysis tools
Greg Hudson
ghudson at mit.edu
Wed Mar 29 13:03:49 EDT 2017
https://github.com/krb5/krb5/commit/a1a9e428b4971c2c8a5520e6c5f28deef3f94228
commit a1a9e428b4971c2c8a5520e6c5f28deef3f94228
Author: Martin Kittel <martin.kittel at sap.com>
Date: Wed Mar 29 09:22:18 2017 +0200
Add null check to placate static analysis tools
In trace_format() when processing lenstr, if p is NULL and len is 0,
skip the call to buf_add_printable_len() as Coverity considers it an
unconditional dereference of p.
[ghudson at mit.edu: added explanation to commit message]
src/lib/krb5/os/trace.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/lib/krb5/os/trace.c b/src/lib/krb5/os/trace.c
index 83c8d4d..1f9be80 100644
--- a/src/lib/krb5/os/trace.c
+++ b/src/lib/krb5/os/trace.c
@@ -173,7 +173,7 @@ trace_format(krb5_context context, const char *fmt, va_list ap)
p = va_arg(ap, const char *);
if (p == NULL && len != 0)
k5_buf_add(&buf, "(null)");
- else
+ else if (p != NULL)
buf_add_printable_len(&buf, p, len);
} else if (strcmp(tmpbuf, "hexlenstr") == 0) {
len = va_arg(ap, size_t);
More information about the cvs-krb5
mailing list