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,
772772 bytes_left -= sizeof (* p );
773773 break ;
774774 }
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+ }
775782 p = (struct network_interface_info_ioctl_rsp * )((u8 * )p + next );
776783 bytes_left -= next ;
777784 }
@@ -783,7 +790,9 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
783790 }
784791
785792 /* 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 ))
787796 cifs_dbg (VFS , "%s: incomplete interface info\n" , __func__ );
788797
789798 ses -> iface_last_update = jiffies ;
You can’t perform that action at this time.
0 commit comments