add buffer overflow protection to MQueueDiagnose()
git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@32 3f5042e3-fb1d-0410-be18-d6ca2573e517
This commit is contained in:
parent
1b4c4d0fd4
commit
2625ed201d
@ -380,7 +380,7 @@ int MQueuePrioritizeJobs(mjob_t **,int *);
|
||||
int MQueueGetBestRQTime(int *,long *);
|
||||
int MQueueScheduleRJobs(int *);
|
||||
int MQueueScheduleSJobs(int *);
|
||||
int MQueueDiagnose(mjob_t **,int *,int,mpar_t *,char *);
|
||||
int MQueueDiagnose(mjob_t **,int *,int,mpar_t *,char *,int);
|
||||
int MQueueCheckStatus(void);
|
||||
int MQueueGetRequeueValue(int *,long,long,double *);
|
||||
int MQueueSelectAllJobs(mjob_t **,int,mpar_t *,int *,int,int,int,char *);
|
||||
|
@ -1 +1 @@
|
||||
#define MSCHED_VERSION "maui-3.2.6p14-snap.1125680408"
|
||||
#define MSCHED_VERSION "maui-3.2.6p14-snap.1126543721"
|
||||
|
@ -925,7 +925,8 @@ int MQueueDiagnose(
|
||||
int *NBJobList,
|
||||
int PLevel,
|
||||
mpar_t *PS,
|
||||
char *Buffer)
|
||||
char *Buffer,
|
||||
int BufSize)
|
||||
|
||||
{
|
||||
int pindex;
|
||||
@ -977,6 +978,9 @@ int MQueueDiagnose(
|
||||
|
||||
for (J = FullQ[0]->Next;J != FullQ[0];J = J->Next)
|
||||
{
|
||||
if (strlen(Buffer) + 256 >= BufSize)
|
||||
break;
|
||||
|
||||
if ((PS->Index > 0) && (MUBMCheck(PS->Index,J->PAL) == FAILURE))
|
||||
continue;
|
||||
|
||||
@ -1183,7 +1187,7 @@ int MQueueDiagnose(
|
||||
|
||||
if (IsBlocked == FALSE)
|
||||
{
|
||||
switch(J->BlockReason)
|
||||
switch (J->BlockReason)
|
||||
{
|
||||
case mjneIdlePolicy:
|
||||
|
||||
@ -1205,7 +1209,12 @@ int MQueueDiagnose(
|
||||
break;
|
||||
} /* END switch(J->BlockReason) */
|
||||
}
|
||||
} /* END for (jindex) */
|
||||
}
|
||||
|
||||
if (J != FullQ[0])
|
||||
{
|
||||
strcat(Buffer,"\nlist truncated\n");
|
||||
}
|
||||
|
||||
return(SUCCESS);
|
||||
} /* END MQueueDiagnose() */
|
||||
|
@ -3739,7 +3739,7 @@ int UIQueueDiagnose(
|
||||
MPolicyMode[PLevel],
|
||||
MAList[ePartition][PIndex]);
|
||||
|
||||
if (MQueueDiagnose(MJob,MUIQ,PLevel,&MPar[PIndex],Buffer) == FAILURE)
|
||||
if (MQueueDiagnose(MJob,MUIQ,PLevel,&MPar[PIndex],Buffer,*BufSize) == FAILURE)
|
||||
{
|
||||
sprintf(Buffer,"cannot evaluate blocked jobs\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user