- allow scriptcontext objects to be dynamic
- enhancements in scriptcontext (error messages stored as properties)
This commit is contained in:
11
stringdict.c
11
stringdict.c
@ -259,6 +259,12 @@ const char *StringDictGetNext(pStringDict self, char *pValue, int iValLen)
|
||||
} else {
|
||||
LLDnodeDataTo(self->iList, &sVal);
|
||||
strncpy(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;
|
||||
}
|
||||
} else { /* start a new one */
|
||||
@ -270,6 +276,11 @@ const char *StringDictGetNext(pStringDict self, char *pValue, int iValLen)
|
||||
self->iTraverse = 1;
|
||||
LLDnodeDataTo(self->iList, &sVal);
|
||||
strncpy(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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user