summaryrefslogtreecommitdiffstats
path: root/fs/udf/unicode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/unicode.c')
-rw-r--r--fs/udf/unicode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 4d7a674ebce5..5599e7535401 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -33,7 +33,7 @@ static int udf_translate_to_linux(uint8_t *, int, uint8_t *, int, uint8_t *,
33 33
34static int udf_char_to_ustr(struct ustr *dest, const uint8_t *src, int strlen) 34static int udf_char_to_ustr(struct ustr *dest, const uint8_t *src, int strlen)
35{ 35{
36 if ((!dest) || (!src) || (!strlen) || (strlen > UDF_NAME_LEN - 2)) 36 if ((!dest) || (!src) || (!strlen) || (strlen > UDF_NAME_LEN))
37 return 0; 37 return 0;
38 38
39 memset(dest, 0, sizeof(struct ustr)); 39 memset(dest, 0, sizeof(struct ustr));
@@ -184,14 +184,14 @@ static int udf_name_from_CS0(struct ustr *utf_o,
184 184
185 ocu = ocu_i->u_name; 185 ocu = ocu_i->u_name;
186 utf_o->u_len = 0; 186 utf_o->u_len = 0;
187 for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) { 187 for (i = 0; (i < ocu_len) && (utf_o->u_len < UDF_NAME_LEN);) {
188 /* Expand OSTA compressed Unicode to Unicode */ 188 /* Expand OSTA compressed Unicode to Unicode */
189 uint32_t c = ocu[i++]; 189 uint32_t c = ocu[i++];
190 if (cmp_id == 16) 190 if (cmp_id == 16)
191 c = (c << 8) | ocu[i++]; 191 c = (c << 8) | ocu[i++];
192 192
193 len = conv_f(c, &utf_o->u_name[utf_o->u_len], 193 len = conv_f(c, &utf_o->u_name[utf_o->u_len],
194 UDF_NAME_LEN - 2 - utf_o->u_len); 194 UDF_NAME_LEN - utf_o->u_len);
195 /* Valid character? */ 195 /* Valid character? */
196 if (len >= 0) 196 if (len >= 0)
197 utf_o->u_len += len; 197 utf_o->u_len += len;