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)
212212 return NULL ;
213213
214214 if (off >= used || off < MFTRECORD_FIXUP_OFFSET_1 ||
215- !IS_ALIGNED (off , 4 )) {
215+ !IS_ALIGNED (off , 8 )) {
216216 return NULL ;
217217 }
218218
@@ -236,8 +236,11 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
236236 off += asize ;
237237 }
238238
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+ */
241244 if (off + 8 > used ) {
242245 static_assert (ALIGN (sizeof (enum ATTR_TYPE ), 8 ) == 8 );
243246 return NULL ;
@@ -259,10 +262,17 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
259262
260263 asize = le32_to_cpu (attr -> size );
261264
265+ if (!IS_ALIGNED (asize , 8 ))
266+ return NULL ;
267+
262268 /* Check overflow and boundary. */
263269 if (off + asize < off || off + asize > used )
264270 return NULL ;
265271
272+ /* Can we use the field attr->non_res. */
273+ if (off + 9 > used )
274+ return NULL ;
275+
266276 /* Check size of attribute. */
267277 if (!attr -> non_res ) {
268278 /* Check resident fields. */
You can’t perform that action at this time.
0 commit comments