changeset 5354:7ced4e5af4c7

8009654: Improve stability of cmsnamed Reviewed-by: bae, prr Contributed-by: jia-hong.chen@oracle.com
author andrew
date Tue, 11 Jun 2013 14:44:01 +0100
parents 8ae68d2b6f36
children 5901523f7ec0
files src/share/native/sun/java2d/cmm/lcms/cmsnamed.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c	Fri Mar 22 15:40:16 2013 -0400
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c	Tue Jun 11 14:44:01 2013 +0100
@@ -514,8 +514,8 @@
     while (v -> Allocated < n)
         GrowNamedColorList(v);
 
-    strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix));
-    strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix));
+    strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix) - 1);
+    strncpy(v ->Suffix, Suffix, sizeof(v ->Suffix) - 1);
     v -> ColorantCount = ColorantCount;
 
     return v;
@@ -571,7 +571,7 @@
 
     if (Name != NULL)
         strncpy(NamedColorList ->List[NamedColorList ->nColors].Name, Name,
-                    sizeof(NamedColorList ->List[NamedColorList ->nColors].Name));
+                    sizeof(NamedColorList ->List[NamedColorList ->nColors].Name) - 1);
     else
         NamedColorList ->List[NamedColorList ->nColors].Name[0] = 0;