[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14285] trunk/blender/source: == bugfix ==
Andrea Weikert
elubie at gmx.net
Sun Mar 30 18:18:01 CEST 2008
Revision: 14285
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14285
Author: elubie
Date: 2008-03-30 18:18:01 +0200 (Sun, 30 Mar 2008)
Log Message:
-----------
== bugfix ==
fix for [#6950] Blender crashes when .blog file top line is 160 characters or more
- made sure BLI_convertstringcode doesn't return more than 240 chars
- went through all callers and fixed places where string passed to BLI_convertstringcode was too short
- TODO: look into increasing sample->name and sound->name too, I prevented crashes, but filename might get shortened.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_main.h
trunk/blender/source/blender/blenkernel/intern/blender.c
trunk/blender/source/blender/blenlib/intern/util.c
trunk/blender/source/blender/makesdna/DNA_space_types.h
trunk/blender/source/blender/python/BPY_interface.c
trunk/blender/source/blender/python/BPY_menus.c
trunk/blender/source/blender/python/api2_2x/Blender.c
trunk/blender/source/blender/src/drawimasel.c
trunk/blender/source/blender/src/editimasel.c
trunk/blender/source/blender/src/editsound.c
trunk/blender/source/blender/src/filelist.c
trunk/blender/source/blender/src/filesel.c
trunk/blender/source/blender/src/header_imasel.c
trunk/blender/source/blender/src/header_info.c
trunk/blender/source/blender/src/usiblender.c
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
Modified: trunk/blender/source/blender/blenkernel/BKE_main.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_main.h 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/blenkernel/BKE_main.h 2008-03-30 16:18:01 UTC (rev 14285)
@@ -47,7 +47,7 @@
typedef struct Main {
struct Main *next, *prev;
- char name[160];
+ char name[240];
short versionfile, subversionfile;
short minversionfile, minsubversionfile;
Modified: trunk/blender/source/blender/blenkernel/intern/blender.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/blender.c 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/blenkernel/intern/blender.c 2008-03-30 16:18:01 UTC (rev 14285)
@@ -415,7 +415,7 @@
if (G.sce != filename) /* these are the same at times, should never copy to the same location */
strcpy(G.sce, filename);
- strcpy(G.main->name, filename); /* is guaranteed current file */
+ BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
MEM_freeN(bfd);
}
Modified: trunk/blender/source/blender/blenlib/intern/util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/util.c 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/blenlib/intern/util.c 2008-03-30 16:18:01 UTC (rev 14285)
@@ -1028,8 +1028,8 @@
int BLI_convertstringcode(char *path, const char *basepath, int framenum)
{
int len, wasrelative;
- char tmp[FILE_MAXDIR+FILE_MAXFILE];
- char base[FILE_MAXDIR];
+ char tmp[FILE_MAX];
+ char base[FILE_MAX];
char vol[3] = {'\0', '\0', '\0'};
BLI_strncpy(vol, path, 3);
@@ -1050,13 +1050,13 @@
strcat(tmp, p);
}
else {
- strcpy(tmp, path);
+ BLI_strncpy(tmp, path, FILE_MAX);
}
#else
- strcpy(tmp, path);
+ BLI_strncpy(tmp, path, FILE_MAX);
#endif
- strcpy(base, basepath);
+ BLI_strncpy(base, basepath, FILE_MAX);
/* push slashes into unix mode - strings entering this part are
potentially messed up: having both back- and forward slashes.
Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h 2008-03-30 16:18:01 UTC (rev 14285)
@@ -167,7 +167,7 @@
int totfile;
char title[24];
- char dir[160];
+ char dir[240];
char file[80];
short type, ofs, flag, sort;
@@ -373,7 +373,7 @@
/* specific stuff for drawing */
char title[24];
- char dir[160];
+ char dir[240];
char file[80];
short type, menu, flag, sort;
Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/python/BPY_interface.c 2008-03-30 16:18:01 UTC (rev 14285)
@@ -1004,10 +1004,10 @@
}
if( pym->dir ) { /* script is in U.pythondir */
- char upythondir[FILE_MAXDIR];
+ char upythondir[FILE_MAX];
/* dirs in Blender can be "//", which has a special meaning */
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
+ BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
BLI_convertstringcode(upythondir, G.sce, 0); /* if so, this expands it */
BLI_make_file_string( "/", filestr, upythondir, pym->filename );
}
Modified: trunk/blender/source/blender/python/BPY_menus.c
===================================================================
--- trunk/blender/source/blender/python/BPY_menus.c 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/python/BPY_menus.c 2008-03-30 16:18:01 UTC (rev 14285)
@@ -457,7 +457,7 @@
{
FILE *fp;
char line[255], w1[255], w2[255], tooltip[255], *tip;
- char upythondir[FILE_MAXDIR];
+ char upythondir[FILE_MAX];
char *homedir = NULL;
int parsing, version, is_userdir;
short group;
@@ -494,13 +494,13 @@
w1[0] = '\0';
fscanf( fp, "# User defined scripts dir: %[^\n]\n", w1 );
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
- BLI_convertstringcode(upythondir, G.sce, 0);
+ BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
+ BLI_convertstringcode(upythondir, G.sce, 0);
- if( strcmp( w1, upythondir ) != 0 )
- return -1;
+ if( strcmp( w1, upythondir ) != 0 )
+ return -1;
- w1[0] = '\0';
+ w1[0] = '\0';
while( fgets( line, 255, fp ) ) { /* parsing file lines */
@@ -604,9 +604,9 @@
if (U.pythondir[0] != '\0' &&
strcmp(U.pythondir, "/") != 0 && strcmp(U.pythondir, "//") != 0)
{
- char upythondir[FILE_MAXDIR];
+ char upythondir[FILE_MAX];
- BLI_strncpy(upythondir, U.pythondir, FILE_MAXDIR);
+ BLI_strncpy(upythondir, U.pythondir, FILE_MAX);
BLI_convertstringcode(upythondir, G.sce, 0);
fprintf( fp, "# User defined scripts dir: %s\n", upythondir );
}
@@ -940,7 +940,7 @@
#ifdef WIN32
if (is_file) {
- result = stat( name, &st );
+ result = stat( name, &st );
} else {
/* needed for win32 only, remove trailing slash */
char name_stat[FILE_MAX];
@@ -976,8 +976,8 @@
int BPyMenu_Init( int usedir )
{
char fname[FILE_MAXDIR];
- char dirname[FILE_MAXDIR];
- char upythondir[FILE_MAXDIR];
+ char dirname[FILE_MAX];
+ char upythondir[FILE_MAX];
char *upydir = U.pythondir, *sdir = NULL;
time_t time_dir1 = 0, time_dir2 = 0, time_file = 0;
int stat_dir1 = 0, stat_dir2 = 0, stat_file = 0;
@@ -1005,14 +1005,14 @@
upydir = NULL;
}
else {
- BLI_strncpy(upythondir, upydir, FILE_MAXDIR);
+ BLI_strncpy(upythondir, upydir, FILE_MAX);
BLI_convertstringcode(upythondir, G.sce, 0);
}
sdir = bpy_gethome(1);
if (sdir) {
- BLI_strncpy(dirname, sdir, FILE_MAXDIR);
+ BLI_strncpy(dirname, sdir, FILE_MAX);
stat_dir1 = bpymenu_GetStatMTime( dirname, 0, &time_dir1 );
if( stat_dir1 < 0 ) {
@@ -1098,7 +1098,7 @@
fprintf(stderr, "Default scripts dir does not seem valid.\n\n");
}
if( stat_dir2 == 0 ) {
- BLI_strncpy(dirname, U.pythondir, FILE_MAXDIR);
+ BLI_strncpy(dirname, U.pythondir, FILE_MAX);
BLI_convertstringcode(dirname, G.sce, 0);
i = bpymenu_ParseDir( dirname, NULL, 1 );
if (i == -1 && DEBUG)
Modified: trunk/blender/source/blender/python/api2_2x/Blender.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Blender.c 2008-03-30 14:23:15 UTC (rev 14284)
+++ trunk/blender/source/blender/python/api2_2x/Blender.c 2008-03-30 16:18:01 UTC (rev 14285)
@@ -371,9 +371,9 @@
}
else if(StringEqual(str, "udatadir")) {
if (U.pythondir[0] != '\0') {
- char upydir[FILE_MAXDIR];
+ char upydir[FILE_MAX];
- BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
+ BLI_strncpy(upydir, U.pythondir, FILE_MAX);
BLI_convertstringcode(upydir, G.sce, 0);
if (BLI_exists(upydir)) {
@@ -397,9 +397,9 @@
}
else if( StringEqual( str, "uscriptsdir" ) ) {
if (U.pythondir[0] != '\0') {
- char upydir[FILE_MAXDIR];
+ char upydir[FILE_MAX];
- BLI_strncpy(upydir, U.pythondir, FILE_MAXDIR);
+ BLI_strncpy(upydir, U.pythondir, FILE_MAX);
BLI_convertstringcode(upydir, G.sce, 0);
if( BLI_exists( upydir ) )
@@ -410,9 +410,9 @@
/* USER PREFS: */
else if( StringEqual( str, "yfexportdir" ) ) {
if (U.yfexportdir[0] != '\0') {
- char yfexportdir[FILE_MAXDIR];
+ char yfexportdir[FILE_MAX];
- BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAXDIR);
+ BLI_strncpy(yfexportdir, U.yfexportdir, FILE_MAX);
BLI_convertstringcode(yfexportdir, G.sce, 0);
if( BLI_exists( yfexportdir ) )
@@ -423,9 +423,9 @@
/* fontsdir */
else if( StringEqual( str, "fontsdir" ) ) {
if (U.fontdir[0] != '\0') {
- char fontdir[FILE_MAXDIR];
+ char fontdir[FILE_MAX];
- BLI_strncpy(fontdir, U.fontdir, FILE_MAXDIR);
+ BLI_strncpy(fontdir, U.fontdir, FILE_MAX);
BLI_convertstringcode(fontdir, G.sce, 0);
if( BLI_exists( fontdir ) )
@@ -436,9 +436,9 @@
/* texturesdir */
else if( StringEqual( str, "texturesdir" ) ) {
if (U.textudir[0] != '\0') {
- char textudir[FILE_MAXDIR];
+ char textudir[FILE_MAX];
- BLI_strncpy(textudir, U.textudir, FILE_MAXDIR);
+ BLI_strncpy(textudir, U.textudir, FILE_MAX);
BLI_convertstringcode(textudir, G.sce, 0);
if( BLI_exists( textudir ) )
@@ -449,9 +449,9 @@
/* texpluginsdir */
else if( StringEqual( str, "texpluginsdir" ) ) {
if (U.plugtexdir[0] != '\0') {
- char plugtexdir[FILE_MAXDIR];
+ char plugtexdir[FILE_MAX];
- BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAXDIR);
+ BLI_strncpy(plugtexdir, U.plugtexdir, FILE_MAX);
BLI_convertstringcode(plugtexdir, G.sce, 0);
if( BLI_exists( plugtexdir ) )
@@ -462,9 +462,9 @@
/* seqpluginsdir */
else if( StringEqual( str, "seqpluginsdir" ) ) {
if (U.plugseqdir[0] != '\0') {
- char plugseqdir[FILE_MAXDIR];
+ char plugseqdir[FILE_MAX];
- BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAXDIR);
+ BLI_strncpy(plugseqdir, U.plugseqdir, FILE_MAX);
BLI_convertstringcode(plugseqdir, G.sce, 0);
if( BLI_exists( plugseqdir ) )
@@ -475,9 +475,9 @@
/* renderdir */
else if( StringEqual( str, "renderdir" ) ) {
if (U.renderdir[0] != '\0') {
- char renderdir[FILE_MAXDIR];
+ char renderdir[FILE_MAX];
- BLI_strncpy(renderdir, U.renderdir, FILE_MAXDIR);
+ BLI_strncpy(renderdir, U.renderdir, FILE_MAX);
BLI_convertstringcode(renderdir, G.sce, 0);
if( BLI_exists( renderdir ) )
@@ -488,9 +488,9 @@
/* soundsdir */
else if( StringEqual( str, "soundsdir" ) ) {
if (U.sounddir[0] != '\0') {
- char sounddir[FILE_MAXDIR];
+ char sounddir[FILE_MAX];
- BLI_strncpy(sounddir, U.sounddir, FILE_MAXDIR);
+ BLI_strncpy(sounddir, U.sounddir, FILE_MAX);
BLI_convertstringcode(sounddir, G.sce, 0);
if( BLI_exists( sounddir ) )
@@ -501,9 +501,9 @@
/* tempdir */
else if( StringEqual( str, "tempdir" ) ) {
if (U.tempdir[0] != '\0') {
- char tempdir[FILE_MAXDIR];
+ char tempdir[FILE_MAX];
- BLI_strncpy(tempdir, U.tempdir, FILE_MAXDIR);
+ BLI_strncpy(tempdir, U.tempdir, FILE_MAX);
BLI_convertstringcode(tempdir, G.sce, 0);
if( BLI_exists( tempdir ) )
@@ -776,9 +776,9 @@
if (sdir) BLI_make_file_string("/", hspath, sdir, "help_browser.py");
if (!sdir || (!BLI_exists(hspath) && (U.pythondir[0] != '\0'))) {
- char upydir[FILE_MAXDIR];
+ char upydir[FILE_MAX];
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list