diff --git a/CHANGELOG b/CHANGELOG index 15fccae3..e03dcdc5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,11 @@ Or maybe a combined option that sets more constant based on an algoritm. (Kenneth Lavrsen) http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x02x07x212816 + * Fixed a syntax error in picture.c get_pgm() which caused the program to seg + fault when a mask file size did not match the picture size. Now the program + correctly gives an error message and continues without the mask. (Kenneth + Lavrsen). + http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x10x08x150720 3.2.4 Formal Release. Summary of changes diff --git a/CREDITS b/CREDITS index 2a148df1..36a185ab 100644 --- a/CREDITS +++ b/CREDITS @@ -770,18 +770,16 @@ Kenneth Lavrsen (Currently project managing Motion) * Added two new conversion specifiers: %f which is filename (full path) and %n which is filetype (sqltype) valid in on_picture_save, on_movie_start, on_movie_end and sql_query. This also means that filename is no longer - appended at the end of the 3 on_xxxx commands. (Kenneth Lavrsen) - * Removed the sql_user_text option that was added in snap 2 (Kenneth - Lavrsen) + appended at the end of the 3 on_xxxx commands. + * Removed the sql_user_text option that was added in snap 2 * Added new sql_query option. This in combination with convertion specifiers incl the two new %f and %n enables the user to use any database structure they please. Added fields is now a simple matter of modifying the sql query. The default is the same as the default in snap1. - (Kenneth Lavrsen). * Change the sequence of events connected with creating files. Data is now written to the databases (if used) before an external commens is on (on_xxxx options) allowing the external program to use the new data - in the database (Kenneth Lavrsen) + in the database * Added an infinite retry scheme for netcams that are not available when Motion is started. Instead of just dying, Motion now retries every 10 seconds until the netcam is available. Until the netcam is available @@ -831,8 +829,11 @@ Kenneth Lavrsen (Currently project managing Motion) too large number of motion config options. Maybe based on feedback we can permanently change the constants and add an additional auto brightness option. Or maybe a combined option that sets more constant based on an algoritm. - (Kenneth Lavrsen) http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2006x02x07x212816 + * Fixed a syntax error in picture.c get_pgm() which caused the program to seg + fault when a mask file size did not match the picture size. Now the program + correctly gives an error message and continues without the mask. + http://www.lavrsen.dk/twiki/bin/view/Motion/BugReport2005x10x08x150720 Mike Lees * Added the onffmpegclose feature. diff --git a/picture.c b/picture.c index 14204217..3689a7de 100644 --- a/picture.c +++ b/picture.c @@ -562,17 +562,17 @@ unsigned char *get_pgm(FILE *picture, int width, int height) if (!fgets(line, 255, picture)) return NULL; - /* check size */ if (sscanf(line, "%d %d", &x, &y)!=2) { motion_log(LOG_ERR, 1, "Failed reading size in pgm file"); return NULL; } - if (x!=width || y!=height) { - motion_log(LOG_ERR, 1, "Wrong image size %dx%d% should be %dx%d", x, y, width, height); + if (x != width || y != height) { + motion_log(LOG_ERR, 1, "Wrong image size %dx%d should be %dx%d", x, y, width, height); return NULL; } + /* Maximum value */ line[0] = '#'; while (line[0] == '#') @@ -586,14 +586,14 @@ unsigned char *get_pgm(FILE *picture, int width, int height) /* read data */ - image=mymalloc(width*height); + image = mymalloc(width * height); for (y=0; y