Fix off by 1 memory allocation
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10127 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3de787f237
commit
22126ca549
1 changed files with 1 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ SWIG_AsCharPtrAndSize(SEXP obj, char** cptr, size_t* psize, int *alloc)
|
||||||
SWIGINTERN char *
|
SWIGINTERN char *
|
||||||
SWIG_strdup(const char *str)
|
SWIG_strdup(const char *str)
|
||||||
{
|
{
|
||||||
char *newstr = %reinterpret_cast(malloc(strlen(str)), char *);
|
char *newstr = %reinterpret_cast(malloc(strlen(str) + 1), char *);
|
||||||
return strcpy(newstr, str);
|
return strcpy(newstr, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue