File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -772,6 +772,13 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
772
772
bytes_left -= sizeof (* p );
773
773
break ;
774
774
}
775
+ /* Validate that Next doesn't point beyond the buffer */
776
+ if (next > bytes_left ) {
777
+ cifs_dbg (VFS , "%s: invalid Next pointer %zu > %zd\n" ,
778
+ __func__ , next , bytes_left );
779
+ rc = - EINVAL ;
780
+ goto out ;
781
+ }
775
782
p = (struct network_interface_info_ioctl_rsp * )((u8 * )p + next );
776
783
bytes_left -= next ;
777
784
}
@@ -783,7 +790,9 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
783
790
}
784
791
785
792
/* Azure rounds the buffer size up 8, to a 16 byte boundary */
786
- if ((bytes_left > 8 ) || p -> Next )
793
+ if ((bytes_left > 8 ) ||
794
+ (bytes_left >= offsetof(struct network_interface_info_ioctl_rsp , Next )
795
+ + sizeof (p -> Next ) && p -> Next ))
787
796
cifs_dbg (VFS , "%s: incomplete interface info\n" , __func__ );
788
797
789
798
ses -> iface_last_update = jiffies ;
You can’t perform that action at this time.
0 commit comments