svn rev #22177: trunk/src/util/support/

epeisach@MIT.EDU epeisach at MIT.EDU
Tue Apr 7 19:59:26 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22177
Commit By: epeisach
Log Message:
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   trunk/src/util/support/utf8_conv.c
Modified: trunk/src/util/support/utf8_conv.c
===================================================================
--- trunk/src/util/support/utf8_conv.c	2009-04-07 21:22:23 UTC (rev 22176)
+++ trunk/src/util/support/utf8_conv.c	2009-04-07 23:59:25 UTC (rev 22177)
@@ -119,10 +119,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