Skip to content

Commit 1e1f35c

Browse files
committed
Fix CID 1393667 (Copy into fixed size buffer)
Signed-off-by: Stefan Weil <[email protected]>
1 parent 85794ca commit 1e1f35c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/opencl/openclwrapper.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
#ifdef USE_OPENCL
3131

32+
#include <cstdio>
33+
#include <vector>
34+
35+
#include "errcode.h" // for ASSERT_HOST
3236
#include "opencl_device_selection.h"
3337
GPUEnv OpenclDevice::gpuEnv;
3438

@@ -758,14 +762,16 @@ int OpenclDevice::ReleaseOpenclRunEnv()
758762
#endif
759763
return 1;
760764
}
765+
761766
inline int OpenclDevice::AddKernelConfig( int kCount, const char *kName )
762767
{
763-
if ( kCount < 1 )
764-
fprintf(stderr,"Error: ( KCount < 1 ) AddKernelConfig\n" );
768+
ASSERT_HOST(kCount > 0);
769+
ASSERT_HOST(strlen(kName) < sizeof(gpuEnv.mArrykernelNames[kCount-1]));
765770
strcpy( gpuEnv.mArrykernelNames[kCount-1], kName );
766771
gpuEnv.mnKernelCount++;
767772
return 0;
768773
}
774+
769775
int OpenclDevice::RegistOpenclKernel()
770776
{
771777
if ( !gpuEnv.mnIsUserCreated )

0 commit comments

Comments
 (0)