Index: ossp-pkg/rc/rc_proc.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v rcsdiff -q -kk '-r1.37' '-r1.38' -u '/v/ossp/cvs/ossp-pkg/rc/rc_proc.c,v' 2>/dev/null --- rc_proc.c 2003/05/26 16:24:08 1.37 +++ rc_proc.c 2003/05/27 13:00:22 1.38 @@ -251,7 +251,7 @@ szTmpfile = malloc(nTmpname); strcpy(szTmpfile, configGetval(RC_TMP_VAL)); if (*(szTmpfile + (strlen(szTmpfile) - 1) * sizeof(char)) != '/') - *(szTmpfile + (strlen(szTmpfile)) * sizeof(char)) = '/'; + strcat(szTmpfile, "/"); strcat(szTmpfile, RC_EVL_TMP); mktemp(szTmpfile); strcat(szTmpfile, RC_EVL_SUF); Index: ossp-pkg/rc/rc_script.c RCS File: /v/ossp/cvs/ossp-pkg/rc/rc_script.c,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/rc/rc_script.c,v' 2>/dev/null --- rc_script.c 2003/05/27 11:56:00 1.23 +++ rc_script.c 2003/05/27 13:00:22 1.24 @@ -125,12 +125,13 @@ rc_section_t *pSec = NULL; char *piLabstart = NULL; int nLabsize = NULL; - char *piSubtemp = NULL; /* To find priority and userid in substrings */ - char *piBlocend = NULL; /* Misnomer used to control section looping */ + char *piSubtemp = NULL; /* To find priority and userid in substrings */ + char *piBlocend = NULL; /* Misnomer used to control section looping */ char *piStart = NULL; char *piEnd = NULL; char *piSep = NULL; char *szUser = NULL; + char *szTemp = NULL; /* Holds temporarily the pri and user strings */ struct passwd *pPwd = NULL; long nPri = 0; long nUid = 0; @@ -210,7 +211,9 @@ /* Handle the section priority */ piStart = piBlocend + *(pnVec + 4); piEnd = piBlocend + *(pnVec + 5); - piSubtemp = strnstr(piStart, RC_DEF_PRG, piEnd - piStart); + szTemp = malloc((piEnd - piStart + 1) * sizeof (char)); + strncpy(szTemp, piStart, piEnd - piStart + 1); + piSubtemp = strstr(szTemp, RC_DEF_PRG); if (piSubtemp) { /* Priority pattern found */ for (nTmp = (int)piSubtemp + strlen(RC_DEF_PRG);\ isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */ @@ -224,7 +227,7 @@ sectionSetpri(pSec, RC_DEF_PRI); /* Handle the section userid */ - piSubtemp = strnstr(piStart, RC_DEF_UIG, piEnd - piStart); + piSubtemp = strstr(szTemp, RC_DEF_UIG); if (piSubtemp) { /* Userid pattern found */ for (nTmp = (int)piSubtemp + strlen(RC_DEF_UIG); \ isspace(*(char *)nTmp); nTmp += sizeof (char)); /* Strip */ @@ -259,6 +262,10 @@ else /* Fallback to default value */ sectionSetuid(pSec, RC_DEF_UID); + /* Cleanup */ + free(szTemp); + szTemp = NULL; + return(pSec); /* Section found, so return the text */ }