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:
William S Fulton 2008-12-21 00:29:48 +00:00
commit f9393a0f06
2 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -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 [] {