mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:32:45 +00:00 
			
		
		
		
	Kernel: Use try_copy_kstring_from_user() in Socket::setsockopt()
This commit is contained in:
		
							parent
							
								
									b96ad76cba
								
							
						
					
					
						commit
						5b13af0edd
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		|  | @ -108,10 +108,10 @@ KResult Socket::setsockopt(int level, int option, Userspace<const void*> user_va | |||
|         if (user_value_size != IFNAMSIZ) | ||||
|             return EINVAL; | ||||
|         auto user_string = static_ptr_cast<const char*>(user_value); | ||||
|         auto ifname = copy_string_from_user(user_string, user_value_size); | ||||
|         if (ifname.is_null()) | ||||
|             return EFAULT; | ||||
|         auto device = NetworkingManagement::the().lookup_by_name(ifname); | ||||
|         auto ifname_or_error = try_copy_kstring_from_user(user_string, user_value_size); | ||||
|         if (ifname_or_error.is_error()) | ||||
|             return ifname_or_error.error(); | ||||
|         auto device = NetworkingManagement::the().lookup_by_name(ifname_or_error.value()->view()); | ||||
|         if (!device) | ||||
|             return ENODEV; | ||||
|         m_bound_interface = device; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling