From: Ezra Peisach Date: Tue, 7 Apr 2009 23:59:25 +0000 (+0000) Subject: Subject k5_utf8s_to_ucs2s could deref NULL pointer.. X-Git-Tag: krb5-1.8-alpha1~560 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0b7cc76b50ea9c035c8137583cd6d99fa0929e0e;p=krb5.git Subject k5_utf8s_to_ucs2s could deref NULL pointer.. Based on usage of this static function, this will never happen as results are always malloced (and checked) by caller. However, the function is already coded to handle the first argument being null - so be consistent throughout. ticket: git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22177 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/support/utf8_conv.c b/src/util/support/utf8_conv.c index 58fb25022..f8e4a496b 100644 --- a/src/util/support/utf8_conv.c +++ b/src/util/support/utf8_conv.c @@ -119,9 +119,11 @@ k5_utf8s_to_ucs2s(krb5_ucs2 *ucs2str, } assert(ucs2len < count); - - /* Add null terminator if there's room in the buffer. */ - ucs2str[ucs2len] = 0; + + if (ucs2str != NULL) { + /* Add null terminator if there's room in the buffer. */ + ucs2str[ucs2len] = 0; + } return ucs2len; }