From 0b7cc76b50ea9c035c8137583cd6d99fa0929e0e Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Tue, 7 Apr 2009 23:59:25 +0000 Subject: [PATCH] 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 --- src/util/support/utf8_conv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; } -- 2.26.2