ossp-pkg/rc/rc_sect.c 1.10 -> 1.11
--- rc_sect.c 2003/05/21 15:16:41 1.10
+++ rc_sect.c 2003/05/27 13:14:08 1.11
@@ -202,17 +202,17 @@
rc_return_t sectionSetndata(rc_section_t *pSec, const char *kszScript, size_t Len)
{ /* Data of section, this is the script body of the particular section */
if (pSec) {
- pSec->m_Bytes = Len * sizeof(char) + sizeof(char); /* Set size */
+ pSec->m_Bytes = (Len + 1) * sizeof(char); /* Set size */
if (pSec->m_szData) { /* The section data is already in use */
free(pSec->m_szData);
pSec->m_szData = malloc(pSec->m_Bytes);
strncpy(pSec->m_szData, kszScript, Len);
- *(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
+ *(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
else { /* Set the data the usual way */
pSec->m_szData = malloc(pSec->m_Bytes);
strncpy(pSec->m_szData, kszScript, Len);
- *(pSec->m_szData + Len) = NULL; /* Terminate outgoing */
+ *(pSec->m_szData + Len) = '\0'; /* Terminate outgoing */
}
return(RC_THROW(RC_OK));
}
|
|