diff options
author | Ezra Peisach <epeisach@mit.edu> | 2009-04-07 23:59:25 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 2009-04-07 23:59:25 +0000 |
commit | 0b7cc76b50ea9c035c8137583cd6d99fa0929e0e (patch) | |
tree | 034eb07febedd322ab81ec8568fbb214c6de2a88 /src/util | |
parent | 6769d4fc0a3fdeef3f0530257d742647a2c847fb (diff) | |
download | krb5-0b7cc76b50ea9c035c8137583cd6d99fa0929e0e.tar.gz krb5-0b7cc76b50ea9c035c8137583cd6d99fa0929e0e.tar.xz krb5-0b7cc76b50ea9c035c8137583cd6d99fa0929e0e.zip |
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
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/support/utf8_conv.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util/support/utf8_conv.c b/src/util/support/utf8_conv.c index 58fb25022e..f8e4a496bc 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; } |