Skip to content

Commit

Permalink
Null pointer Dereference.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdelnero committed Nov 14, 2023
1 parent 63a8153 commit 6aafae5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib_jtag_core/src/os_interface/os_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ int genos_createthread(jtag_core* jtag_ctx,void* hwcontext,THREADFUNCTION thread
pthread_attr_setschedparam (&threadattrib, &param);

print_callback = jtag_ctx->jtagcore_print_callback;

threadinitptr=(threadinit *)malloc(sizeof(threadinit));
if(threadinitptr)
{
Expand All @@ -333,7 +333,7 @@ int genos_createthread(jtag_core* jtag_ctx,void* hwcontext,THREADFUNCTION thread
}
else
{
print_callback("genos_createthread : memory allocation failed !");
print_callback("genos_createthread : memory allocation failed !");
}

return sit;
Expand Down Expand Up @@ -453,7 +453,7 @@ char * genos_getfilenameext(char * fullpath,char * filenameext, int type )
char * filename;
int len,i;

filename=genos_getfilenamebase(fullpath,0,type);
filename = genos_getfilenamebase(fullpath,0,type);

if(filename)
{
Expand Down Expand Up @@ -550,14 +550,19 @@ int genos_checkfileext(char * path,char *ext,int type)
{
char pathext[16];
char srcext[16];
char * ptr;

if(path && ext)
{
pathext[0] = '\0';
srcext[0] = ' ';
srcext[1] = '\0';

if( ( strlen(genos_getfilenameext(path,0,type)) < 16 ) && ( strlen(ext) < 16 ))
ptr = genos_getfilenameext(path,0,type);
if(!ptr)
return 0;

if( ( strlen(ptr) < 16 ) && ( strlen(ext) < 16 ))
{
genos_getfilenameext(path,(char*)&pathext,type);
genos_strlower(pathext);
Expand Down

0 comments on commit 6aafae5

Please sign in to comment.