mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	seq: Add overflow check in snd_seq_ev_set_ump_data()
It's better to add a sanity check than sorry for breaking. Now the function return -EINVAL. Closes: https://github.com/alsa-project/alsa-lib/issues/346 Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									ec20272797
								
							
						
					
					
						commit
						91bbe55894
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		|  | @ -300,10 +300,13 @@ static inline void snd_seq_ev_set_ump(snd_seq_ump_event_t *ev) | |||
|  * \param data UMP packet data | ||||
|  * \param bytes UMP packet size in bytes | ||||
|  */ | ||||
| static inline void snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes) | ||||
| static inline int snd_seq_ev_set_ump_data(snd_seq_ump_event_t *ev, void *data, size_t bytes) | ||||
| { | ||||
| 	if (bytes > 16) | ||||
| 		return -EINVAL; | ||||
| 	snd_seq_ev_set_ump(ev); | ||||
| 	memcpy(ev->ump, data, bytes); | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /* set and send a queue control event */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Takashi Iwai
						Takashi Iwai