[sfnt] A refinement of the previous commit. * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, tt_name_entry_ascii_from_other): Stop at null byte.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/ChangeLog b/ChangeLog
index c42508c..d723dfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2012-03-14 Huw Davies <huw@codeweavers.com>
+ [sfnt] A refinement of the previous commit.
+
+ * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
+ tt_name_entry_ascii_from_other): Stop at null byte.
+
+2012-03-14 Huw Davies <huw@codeweavers.com>
+
[sfnt] Add `name' table compatibility to MS Windows.
* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 3b9fd47..2bc4bd9 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -64,13 +64,17 @@
for ( n = 0; n < len; n++ )
{
code = FT_NEXT_USHORT( read );
- if ( code != 0 && ( code < 32 || code > 127 ) )
+
+ if ( code == 0 )
+ break;
+
+ if ( code < 32 || code > 127 )
code = '?';
string[n] = (char)code;
}
- string[len] = 0;
+ string[n] = 0;
return string;
}
@@ -95,13 +99,17 @@
for ( n = 0; n < len; n++ )
{
code = *read++;
- if ( code != 0 && ( code < 32 || code > 127 ) )
+
+ if ( code == 0 )
+ break;
+
+ if ( code < 32 || code > 127 )
code = '?';
string[n] = (char)code;
}
- string[len] = 0;
+ string[n] = 0;
return string;
}