svn rev #22251: branches/krb5-1-7/src/util/support/

tlyu@MIT.EDU tlyu at MIT.EDU
Wed Apr 15 16:07:37 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22251
Commit By: tlyu
Log Message:
ticket: 6468
subject: k5_utf8s_to_ucs2s could deref NULL pointer...
version_fixed: 1.7
tags: pullup
target_version: 1.7

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.


Changed Files:
U   branches/krb5-1-7/src/util/support/utf8_conv.c
Modified: branches/krb5-1-7/src/util/support/utf8_conv.c
===================================================================
--- branches/krb5-1-7/src/util/support/utf8_conv.c	2009-04-15 20:07:34 UTC (rev 22250)
+++ branches/krb5-1-7/src/util/support/utf8_conv.c	2009-04-15 20:07:37 UTC (rev 22251)
@@ -118,10 +118,12 @@
     }
 
     assert(ucs2len < count);
+    
+    if (ucs2str != NULL) {
+	/* Add null terminator if there's room in the buffer. */
+	ucs2str[ucs2len] = 0;
+    }
 
-    /* Add null terminator if there's room in the buffer. */
-    ucs2str[ucs2len] = 0;
-
     return ucs2len;
 }
 




More information about the cvs-krb5 mailing list