Fixing bugs in future:

DNA reconstruct now terminates strings, when the new string
in a file is longer than in current definition. This will
enable a safer ID and other name lengthening, keeping at
least some forward compitability.
This commit is contained in:
Ton Roosendaal
2011-01-05 10:54:30 +00:00
parent 64c3ea272e
commit 7ec8761250

View File

@@ -869,6 +869,10 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const cha
mul= len/oldsize;
mul*= (cursize < oldsize)? cursize: oldsize;
memcpy(curdata, olddata, mul);
/* terminate strings */
if(oldsize > cursize && strcmp(type, "char")==0)
curdata[mul-1]= 0;
}
else {
if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);