mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Make sure type strings are nul terminated.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26119 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b3417764f6
commit
9b8cdcf311
5 changed files with 46 additions and 14 deletions
|
@ -170,13 +170,24 @@
|
|||
if (_info == 0)
|
||||
{
|
||||
const char *types = _methodTypes;
|
||||
char *outTypes;
|
||||
unsigned int i;
|
||||
|
||||
_info = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(NSArgumentInfo)*(_numArgs+1));
|
||||
/* Allocate space enough for an NSArgumentInfo structure for each
|
||||
* argument (including the return type), and enough space to hold
|
||||
* the type information for each argument as a nul terminated
|
||||
* string.
|
||||
*/
|
||||
outTypes = NSZoneMalloc(NSDefaultMallocZone(),
|
||||
sizeof(NSArgumentInfo)*(_numArgs+1) + strlen(types)*2);
|
||||
_info = (NSArgumentInfo*)outTypes;
|
||||
outTypes = outTypes + sizeof(NSArgumentInfo)*(_numArgs+1);
|
||||
/* Fill in the full argment information for each arg.
|
||||
*/
|
||||
for (i = 0; i <= _numArgs; i++)
|
||||
{
|
||||
types = mframe_next_arg(types, &_info[i]);
|
||||
types = mframe_next_arg(types, &_info[i], outTypes);
|
||||
outTypes += strlen(outTypes) + 1;
|
||||
}
|
||||
}
|
||||
return _info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue