From: Greg Hudson Date: Wed, 14 Jan 2015 18:10:39 +0000 (-0500) Subject: Check for null *iter_p in profile_iterator() X-Git-Tag: krb5-1.13.1-final~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0a12dd63f696b95b35826aefed7282bd7954325;p=thirdparty%2Fkrb5.git Check for null *iter_p in profile_iterator() In profile_iterator(), return PROF_MAGIC_ITERATOR if *iter_p is NULL, instead of dereferencing a null pointer, as we did prior to 1.10. Correct calling code will not trigger this case, but incorrect code has been reported in the field. (cherry picked from commit 9a343200d305e7c8df6e556d63afaee42194175f) ticket: 8059 version_fixed: 1.13.1 status: resolved --- diff --git a/src/util/profile/prof_get.c b/src/util/profile/prof_get.c index 3eba787222..16a1762df1 100644 --- a/src/util/profile/prof_get.c +++ b/src/util/profile/prof_get.c @@ -579,7 +579,7 @@ profile_iterator(void **iter_p, char **ret_name, char **ret_value) *ret_name = NULL; if (ret_value) *ret_value = NULL; - if (iter->magic != PROF_MAGIC_ITERATOR) + if (iter == NULL || iter->magic != PROF_MAGIC_ITERATOR) return PROF_MAGIC_ITERATOR; profile = iter->profile;