Apply patch #2440046 which fixes possible seg faults for member and global variable char arrays when the strings are larger than the string array size.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10994 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d115e52bc0
commit
f9393a0f06
2 changed files with 16 additions and 4 deletions
|
|
@ -1,6 +1,10 @@
|
|||
Version 1.3.37 (in progress)
|
||||
============================
|
||||
|
||||
2008-12-21: wsfulton
|
||||
Apply patch #2440046 which fixes possible seg faults for member and global
|
||||
variable char arrays when the strings are larger than the string array size.
|
||||
|
||||
2008-12-20: wsfulton
|
||||
The ccache compiler cache has been adapted to work with SWIG and
|
||||
named ccache-swig. It now works with C/C++ compilers as well as SWIG
|
||||
|
|
|
|||
16
Lib/swig.swg
16
Lib/swig.swg
|
|
@ -423,13 +423,21 @@ namespace std {
|
|||
/* Character array handling */
|
||||
|
||||
%typemap(memberin) char [ANY] {
|
||||
if ($input) strncpy((char *)$1, (const char *)$input, $1_dim0);
|
||||
else $1[0] = 0;
|
||||
if($input) {
|
||||
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
|
||||
$1[$1_dim0-1] = 0;
|
||||
} else {
|
||||
$1[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(globalin) char [ANY] {
|
||||
if ($input) strncpy((char *)$1, (const char *)$input, $1_dim0);
|
||||
else $1[0] = 0;
|
||||
if($input) {
|
||||
strncpy((char*)$1, (const char *)$input, $1_dim0-1);
|
||||
$1[$1_dim0-1] = 0;
|
||||
} else {
|
||||
$1[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(memberin) char [] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue