[Git][NTPsec/ntpsec][master] Appease Coverity - prevent a null-pointer warning.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Feb 2 23:24:50 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
b88776e1 by Eric S. Raymond at 2016-02-02T18:24:38-05:00
Appease Coverity - prevent a null-pointer warning.

- - - - -


1 changed file:

- ntpdig/utilities.c


Changes:

=====================================
ntpdig/utilities.c
=====================================
--- a/ntpdig/utilities.c
+++ b/ntpdig/utilities.c
@@ -162,6 +162,13 @@ tv_to_str(
 	mm = abs(lto % 60);
 
 	buf = emalloc(bufsize);
+
+	/* should never happen - here to appease Coverity */
+	if (p_tm_local == NULL) {
+	    strlcpy(buf, "tv_to_str(): invalid date", bufsize);
+	    return buf;
+	}
+
 	snprintf(buf, bufsize,
 		 json ? jsonstyle : oldstyle,
 		 p_tm_local->tm_year + 1900,



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b88776e15b23758f9413297c6359d6187e887778
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160202/6642b92a/attachment.html>


More information about the vc mailing list