OSSP CVS Repository

ossp - Check-in [3386]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3386
Date: 2003-May-26 18:24:08 (local)
2003-May-26 16:24:08 (UTC)
User:ms
Branch:
Comment: Fix logic to avoid false positives when comparing sections of unequal lengths.
Tickets:
Inspections:
Files:
ossp-pkg/rc/rc_proc.c      1.36 -> 1.37     1 inserted, 2 deleted
ossp-pkg/rc/rc_script.c      1.21 -> 1.22     2 inserted, 1 deleted

ossp-pkg/rc/rc_proc.c 1.36 -> 1.37

--- rc_proc.c    2003/05/26 16:03:57     1.36
+++ rc_proc.c    2003/05/26 16:24:08     1.37
@@ -147,9 +147,8 @@
                 /* Extract a section from the temp script, and append it */
                 pSec = scriptSection(pTempscript, pRc->m_pAnal->m_pszSecs[nSect]);
 
-                if (pSec) { /* Only copy if the section lookup succeeds */
+                if (pSec) /* Only copy if the section lookup succeeds */
                     labelAppendsec(pRc->m_ppLabvec[nRc], pSec);
-                }
                 else if (configGetval(RC_DBG_VAL)) /* Only show if debug set */
                     fprintf(stderr, "#Warning: Missing section '%s' in %s!\n",\
                         pRc->m_pAnal->m_pszSecs[nSect],\


ossp-pkg/rc/rc_script.c 1.21 -> 1.22

--- rc_script.c  2003/05/23 14:14:09     1.21
+++ rc_script.c  2003/05/26 16:24:08     1.22
@@ -200,7 +200,8 @@
         nLabsize   = *(pnVec + 3) - *(pnVec + 2);
 
         /* Test the substring. If it matches our label, make a new section */
-        if (!strncmp(piLabstart, kszSecname, nLabsize)) {
+        if (strncmp(piLabstart, kszSecname, nLabsize) == 0 \
+            && nLabsize == strlen(kszSecname) * sizeof (char)) {
             /* Handle the section body */
             piStart   = piBlocend + *(pnVec + 6);
             piEnd     = piBlocend + *(pnVec + 7);

CVSTrac 2.0.1