From: Tom Yu Date: Wed, 15 Apr 2009 20:07:37 +0000 (+0000) Subject: k5_utf8s_to_ucs2s could deref NULL pointer.. X-Git-Tag: krb5-1.7-beta1~16 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d02d9b4109be04c12b477a031182542f3062bccd;p=krb5.git k5_utf8s_to_ucs2s could deref NULL pointer.. pull up r22177 from trunk ------------------------------------------------------------------------ r22177 | epeisach | 2009-04-07 19:59:25 -0400 (Tue, 07 Apr 2009) | 10 lines Changed paths: M /trunk/src/util/support/utf8_conv.c ticket: 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: 6468 version_fixed: 1.7 tags: pullup target_version: 1.7 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@22251 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/support/utf8_conv.c b/src/util/support/utf8_conv.c index 531b3d2d2..15e4521cc 100644 --- a/src/util/support/utf8_conv.c +++ b/src/util/support/utf8_conv.c @@ -118,9 +118,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; }