OSSP CVS Repository

ossp - Difference in ossp-pkg/rc/rc_util.c versions 1.8 and 1.9
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/rc/rc_util.c 1.8 -> 1.9

--- rc_util.c    2003/05/20 17:14:17     1.8
+++ rc_util.c    2003/05/27 14:51:38     1.9
@@ -57,6 +57,7 @@
 {
     int nSecs  = 0;
     int nIndex = 0;
+    size_t nBytes  = 0;
     char **pszTemp = NULL;
 
     if (kpszVec) {
@@ -64,9 +65,9 @@
         pszTemp = malloc(sizeof (char **) * nSecs + 1);
 
         for (nIndex = 0; kpszVec[nIndex]; nIndex++) {           /* Copy loop */
-            pszTemp[nIndex] = malloc(strlen(kpszVec[nIndex]));  /* for each  */
-            memcpy(pszTemp[nIndex], kpszVec[nIndex],            /* element   */
-                   strlen(kpszVec[nIndex]));                    /* in vector */
+            nBytes = (strlen(kpszVec[nIndex]) + 1) * sizeof(char); /* for each */
+            pszTemp[nIndex] = malloc(nBytes);                   /* element   */
+            memcpy(pszTemp[nIndex], kpszVec[nIndex], nBytes);   /* in vector */
         }
         pszTemp[nIndex] = NULL; /* Used later to find the end of the array */
         return(pszTemp);        /* Success */

CVSTrac 2.0.1