enforce string limits (reported by pedantic checking tools & some developers).

mostly replace strcpy with BLI_strncpy and multiple strcat's with a BLI_snprintf().
also fix possible crash if CWD isnt available.
This commit is contained in:
Campbell Barton
2011-02-13 03:21:27 +00:00
parent 9e03a0d476
commit 867fc4b463
49 changed files with 201 additions and 239 deletions

View File

@@ -138,8 +138,8 @@ static int print_version(int argc, char **argv, void *data);
extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
char bprogname[FILE_MAX]; /* from blenpluginapi:pluginapi.c */
char btempdir[FILE_MAX];
#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
@@ -1145,7 +1145,7 @@ int main(int argc, char **argv)
// copy path to executable in bprogname. playanim and creting runtimes
// need this.
BLI_where_am_i(bprogname, argv[0]);
BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
#ifdef BUILD_DATE
strip_quotes(build_date);
@@ -1212,7 +1212,7 @@ int main(int argc, char **argv)
WM_init(C, argc, argv);
/* this is properly initialized with user defs, but this is default */
BLI_where_is_temp( btempdir, 1 ); /* call after loading the startup.blend so we can read U.tempdir */
BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */
#ifndef DISABLE_SDL
BLI_setenv("SDL_VIDEODRIVER", "dummy");
@@ -1223,7 +1223,7 @@ int main(int argc, char **argv)
WM_init(C, argc, argv);
BLI_where_is_temp( btempdir, 0 ); /* call after loading the startup.blend so we can read U.tempdir */
BLI_where_is_temp(btempdir, FILE_MAX, 0); /* call after loading the startup.blend so we can read U.tempdir */
}
#ifdef WITH_PYTHON
/**