Skip to content

Commit 902926e

Browse files
author
claude
committed
fixed some seg faults with strings
1 parent 6689e28 commit 902926e

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2007-11-13 Claude Lepage <[email protected]>
2+
* fixed some string manipulations that were causing
3+
segmentation faults
4+
15
2005-04-07 Andrew Janke <[email protected]>
26

37
* removed multiple #def MALLOC's replaced with GI_MALLOC

Makefile.am

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ noinst_HEADERS = glim.h \
1313

1414
EXTRA_DIST = $(m4_files)
1515

16-
m4_files = m4/mni_REQUIRE_LIB.m4 \
17-
m4/mni_REQUIRE_MNILIBS.m4 \
18-
m4/smr_WITH_BUILD_PATH.m4
19-
20-
16+
m4_files = m4/acx_pthread.m4 \
17+
m4/ax_check_gl.m4 \
18+
m4/ax_check_glu.m4 \
19+
m4/ax_check_glut.m4 \
20+
m4/ax_lang_compiler_ms.m4 \
21+
m4/lf_link_headers.m4 \
22+
m4/mni_REQUIRE_LIB.m4 \
23+
m4/mni_REQUIRE_MNILIBS.m4 \
24+
m4/mni_REQUIRE_OPENINVENTOR.m4 \
25+
m4/mni_cxx_have_koenig_lookup.m4 \
26+
m4/smr_CGAL_MAKEFILE.m4 \
27+
m4/smr_OPTIONAL_LIB.m4 \
28+
m4/smr_REQUIRED_LIB.m4 \
29+
m4/smr_WITH_BUILD_PATH.m4
2130

NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 1.1.2
1+
Version 1.2
22

33
* fixed some string manipulations that were causing
44
segmentation faults

glim.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,8 @@ int get_contrast_from_column(char *contrast_column, int num_columns,
403403

404404
if(column > num_columns) {
405405
fprintf(stderr,"\nError in get_contrast_from_column: column number too large.\n");
406+
407+
printf( "column = %d num_columns = %d\n", column, num_columns );
406408
return FALSE;
407409
}
408410

glim_image.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,7 +2300,7 @@ int get_avg_raw(char *dst, char *key, int argc, char **argv)
23002300
---------------------------------------------------------------------------- */
23012301
void create_stat_variable(Program_Data *program_data, char **input_files)
23022302
{
2303-
char *outfile;
2303+
char *outfile = NULL;
23042304
int mincid, varid;
23052305
int ifile, itest;
23062306
int icont;
@@ -2329,16 +2329,16 @@ void create_stat_variable(Program_Data *program_data, char **input_files)
23292329
char *link_str = "link-function";
23302330
char *variance_fun_str = "variance-function";
23312331
char *family_str = "exponential-family";
2332-
char *param_str, *contr_str;
2332+
char *param_str = NULL, *contr_str = NULL;
23332333
char *int_lambda_str = "integrated-det-lambda";
23342334
char *search_vol_str = "search-volume";
23352335
char *search_file_str = "search-region-file";
23362336
char *pooled_fwhm_str = "pooled-FWHM-estimate";
23372337
char *int_fwhm_str = "integrated-FWHM-estimate";
23382338
char *fwhm_file_str = "local-FWHM-file";
23392339
char *fwhm_matrix_str = "pooled-lambda-matrix";
2340-
char *fwhm_matrix_gaussian_str;
2341-
char *fwhm_matrix_avg_str;
2340+
char *fwhm_matrix_gaussian_str = NULL;
2341+
char *fwhm_matrix_avg_str = NULL;
23422342
char *num_fwhm_str = "num-voxel-pool-FWHM";
23432343
glm_obj = program_data->glm_obj;
23442344
lambda_buffer = program_data->lambda_buffer;
@@ -3101,7 +3101,7 @@ void create_glim_parameters(Glm_Object *glm_obj, char **input_files,
31013101
+ 15*glm_obj->design_matrix->num_columns +
31023102
300));
31033103
sprintf(tmpstring,"Using file: %s. Regressors: ", input_files[i]);
3104-
strcat(tmpstring2[i], tmpstring);
3104+
strcpy(tmpstring2[i], tmpstring);
31053105
for(j=0; j<glm_obj->design_matrix->num_columns; j++) {
31063106
sprintf(tmpstring, "%5.2e ",glm_obj->design_matrix->values[i][j]);
31073107
strcat(tmpstring2[i], tmpstring);

0 commit comments

Comments
 (0)