You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
The opt_opencl_bench function copied the device name using strcpy without checking if the source string was larger. This patch fixes this by replacing the strcpy with av_strlcpy, with the string copy size capped to the destination buffer size. Signed-off-by: Maneesh Gupta <maneesh.gupta@amd.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
				
					committed by
					
						 Michael Niedermayer
						Michael Niedermayer
					
				
			
			
				
	
			
			
			
						parent
						
							b410c69fb6
						
					
				
				
					commit
					cf234552b8
				
			| @@ -22,6 +22,7 @@ | ||||
| #include "libavutil/time.h" | ||||
| #include "libavutil/log.h" | ||||
| #include "libavutil/opencl.h" | ||||
| #include "libavutil/avstring.h" | ||||
| #include "cmdutils.h" | ||||
|  | ||||
| typedef struct { | ||||
| @@ -238,7 +239,8 @@ int opt_opencl_bench(void *optctx, const char *opt, const char *arg) | ||||
|                 devices[count].platform_idx = i; | ||||
|                 devices[count].device_idx = j; | ||||
|                 devices[count].runtime = score; | ||||
|                 strcpy(devices[count].device_name, device_node->device_name); | ||||
|                 av_strlcpy(devices[count].device_name, device_node->device_name, | ||||
|                            sizeof(devices[count].device_name)); | ||||
|                 count++; | ||||
|             } | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user