- fixed some strlcpy bugs

This commit is contained in:
zolliker
2010-04-15 09:40:27 +00:00
parent ce0e418326
commit 5ffe4f3905
3 changed files with 2 additions and 16 deletions

View File

@ -170,11 +170,6 @@ int StringDictGet(pStringDict self, char *name, char *pResult, int iLen)
return strlen(sVal.value) + 1; /* for \0 */
} else {
strlcpy(pResult, sVal.value, iLen);
/* strncpy is not guaranteed to be '\0' terminated */
if (iLen > 0 && pResult[iLen - 1] != '\0') {
/* overflow */
pResult[iLen - 1] = '\0';
}
return 1;
}
}
@ -261,11 +256,6 @@ const char *StringDictGetNext(pStringDict self, char *pValue, int iValLen)
} else {
LLDnodeDataTo(self->iList, &sVal);
strlcpy(pValue, sVal.value, iValLen);
/* strncpy is not guaranteed to be '\0' terminated */
if (iValLen > 0 && pValue[iValLen-1] != '\0') {
/* overflow */
pValue[iValLen-1] = '\0';
}
return sVal.name;
}
@ -278,11 +268,6 @@ const char *StringDictGetNext(pStringDict self, char *pValue, int iValLen)
self->iTraverse = 1;
LLDnodeDataTo(self->iList, &sVal);
strlcpy(pValue, sVal.value, iValLen);
/* strncpy is not guaranteed to be '\0' terminated */
if (iValLen > 0 && pValue[iValLen-1] != '\0') {
/* overflow */
pValue[iValLen-1] = '\0';
}
return sVal.name;
}
}