From: Martin Kittel Date: Wed, 29 Mar 2017 07:22:18 +0000 (+0200) Subject: Add null check to placate static analysis tools X-Git-Tag: krb5-1.16-beta1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1a9e428b4971c2c8a5520e6c5f28deef3f94228;p=thirdparty%2Fkrb5.git 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@mit.edu: added explanation to commit message] --- diff --git a/src/lib/krb5/os/trace.c b/src/lib/krb5/os/trace.c index 83c8d4db87..1f9be80f3d 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);