diff --git a/CHANGELOG b/CHANGELOG index a50eb78..2b3734a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Maui 3.2.6p14 Features + - Fix buffer overflow in mdiag -p - Fixed bug with floating generic resource tracking - Added support for NODEMEMOVERCOMMITFACTOR on TORQUE - Integrated latest DOE S3 communications library diff --git a/src/moab/MPriority.c b/src/moab/MPriority.c index bfdd808..efca285 100644 --- a/src/moab/MPriority.c +++ b/src/moab/MPriority.c @@ -32,7 +32,7 @@ int MJobGetStartPriority( int PIndex, /* I */ double *Priority, /* O */ int Mode, /* I */ - char *Buffer) /* O (optional) */ + char *Buffer) /* O (optional,minsize=MMAX_BUFFER) */ { double Prio; @@ -95,6 +95,9 @@ int MJobGetStartPriority( unsigned long MinWCLimit; + char *BPtr; + int BSpace; + const char *FName = "MJobGetStartPriority"; DBG(6,fSCHED) DPrint("%s(%s,%d,%s,%s)\n", @@ -489,8 +492,9 @@ int MJobGetStartPriority( } } /* END if (CWeight[mpcUsage] != 0) */ - sprintf(Buffer,"%s%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", - Buffer, + MUSNInit(&BPtr,&BSpace,Buffer,MMAX_BUFFER); + + MUSNPrintF(&BPtr,&BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", "Job", "PRIORITY", '*', @@ -509,8 +513,7 @@ int MJobGetStartPriority( (int)strlen(CHeader[mpcUsage]), CHeader[mpcUsage]); - sprintf(Buffer,"%s%20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", - Buffer, + MUSNPrintF(&BPtr,&BSpace,"%20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", "Weights", "--------", ' ', @@ -529,7 +532,7 @@ int MJobGetStartPriority( (int)strlen(CWLine[mpcUsage]), CWLine[mpcUsage]); - strcat(Buffer,"\n"); + MUSNPrintF(&BPtr,&BSpace,"\n"); DBG(5,fUI) DPrint("INFO: %s header created\n", FName); @@ -643,10 +646,9 @@ int MJobGetStartPriority( } } /* END for (cindex) */ - strcat(Buffer,"\n"); + MUSNPrintF(&BPtr,&BSpace,"\n"); - sprintf(Buffer,"%s%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", - Buffer, + MUSNPrintF(&BPtr,&BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n", "Percent Contribution", "--------", ' ', @@ -665,9 +667,9 @@ int MJobGetStartPriority( (int)strlen(CFooter[mpcUsage]), CFooter[mpcUsage]); - strcat(Buffer,"\n"); + MUSNPrintF(&BPtr,&BSpace,"\n"); - strcat(Buffer,"* indicates system prio set on job\n"); + MUSNPrintF(&BPtr,&BSpace,"* indicates system prio set on job\n"); return(SUCCESS); } /* END if (Mode == 2) */ @@ -1355,8 +1357,7 @@ int MJobGetStartPriority( } } /* END if (CWeight[mpcUsage] != 0) */ - sprintf(Buffer,"%s%-20s %10.0lf%c %*s%*s%*s%*s%*s%*s%*s\n", - Buffer, + MUSNPrintF(&BPtr,&BSpace,"%-20s %10.0lf%c %*s%*s%*s%*s%*s%*s%*s\n", J->Name, Prio, (J->SystemPrio > 0) ? '*' : ' ',