File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
212
212
return NULL ;
213
213
214
214
if (off >= used || off < MFTRECORD_FIXUP_OFFSET_1 ||
215
- !IS_ALIGNED (off , 4 )) {
215
+ !IS_ALIGNED (off , 8 )) {
216
216
return NULL ;
217
217
}
218
218
@@ -236,8 +236,11 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
236
236
off += asize ;
237
237
}
238
238
239
- /* Can we use the first field (attr->type). */
240
- /* NOTE: this code also checks attr->size availability. */
239
+ /*
240
+ * Can we use the first fields:
241
+ * attr->type,
242
+ * attr->size
243
+ */
241
244
if (off + 8 > used ) {
242
245
static_assert (ALIGN (sizeof (enum ATTR_TYPE ), 8 ) == 8 );
243
246
return NULL ;
@@ -259,10 +262,17 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
259
262
260
263
asize = le32_to_cpu (attr -> size );
261
264
265
+ if (!IS_ALIGNED (asize , 8 ))
266
+ return NULL ;
267
+
262
268
/* Check overflow and boundary. */
263
269
if (off + asize < off || off + asize > used )
264
270
return NULL ;
265
271
272
+ /* Can we use the field attr->non_res. */
273
+ if (off + 9 > used )
274
+ return NULL ;
275
+
266
276
/* Check size of attribute. */
267
277
if (!attr -> non_res ) {
268
278
/* Check resident fields. */
You can’t perform that action at this time.
0 commit comments