File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -127,12 +127,13 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni,
127
127
{
128
128
size_t off ;
129
129
u16 sz ;
130
+ const unsigned le_min_size = le_size (0 );
130
131
131
132
if (!le ) {
132
133
le = ni -> attr_list .le ;
133
134
} else {
134
135
sz = le16_to_cpu (le -> size );
135
- if (sz < sizeof ( struct ATTR_LIST_ENTRY ) ) {
136
+ if (sz < le_min_size ) {
136
137
/* Impossible 'cause we should not return such le. */
137
138
return NULL ;
138
139
}
@@ -141,16 +142,15 @@ struct ATTR_LIST_ENTRY *al_enumerate(struct ntfs_inode *ni,
141
142
142
143
/* Check boundary. */
143
144
off = PtrOffset (ni -> attr_list .le , le );
144
- if (off + sizeof ( struct ATTR_LIST_ENTRY ) > ni -> attr_list .size ) {
145
+ if (off + le_min_size > ni -> attr_list .size ) {
145
146
/* The regular end of list. */
146
147
return NULL ;
147
148
}
148
149
149
150
sz = le16_to_cpu (le -> size );
150
151
151
152
/* Check le for errors. */
152
- if (sz < sizeof (struct ATTR_LIST_ENTRY ) ||
153
- off + sz > ni -> attr_list .size ||
153
+ if (sz < le_min_size || off + sz > ni -> attr_list .size ||
154
154
sz < le -> name_off + le -> name_len * sizeof (short )) {
155
155
return NULL ;
156
156
}
Original file line number Diff line number Diff line change @@ -527,8 +527,6 @@ struct ATTR_LIST_ENTRY {
527
527
528
528
}; // sizeof(0x20)
529
529
530
- static_assert (sizeof (struct ATTR_LIST_ENTRY ) == 0x20 );
531
-
532
530
static inline u32 le_size (u8 name_len )
533
531
{
534
532
return ALIGN (offsetof(struct ATTR_LIST_ENTRY , name ) +
You can’t perform that action at this time.
0 commit comments