From 4aa0672480a4638a8e8b8d7a9513781677915ff3 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 7 Sep 2014 22:51:19 +0000 Subject: Fix buffer overflow git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2274 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/cameratopam/foveon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/converter/other/cameratopam/foveon.c b/converter/other/cameratopam/foveon.c index aa42da36..f439bd52 100644 --- a/converter/other/cameratopam/foveon.c +++ b/converter/other/cameratopam/foveon.c @@ -472,8 +472,8 @@ foveon_interpolate(float coeff[3][4]) { sgrow = calloc (dim[1], sizeof *sgrow); sgx = (width + dim[1]-2) / (dim[1]-1); - black = calloc (height, sizeof *black); - for (row=0; row < height; row++) { + black = calloc (height, sizeof(black[0])); + for (row=0; row < height; ++row) { unsigned int i; for (i=0; i < 3; ++i) { unsigned int j; @@ -486,8 +486,8 @@ foveon_interpolate(float coeff[3][4]) { foveon_avg (image[row*width]+c, dscr[1], cfilt) * 3 - ddft[0][c][0] ) / 4 - ddft[0][c][1]; } - memcpy (black, black+8, sizeof *black*8); - memcpy (black+height-11, black+height-22, 11*sizeof *black); + memcpy (black, black+8, 8 * sizeof(black[0])); + memcpy (black+height-11, black+height-22, 11*(sizeof black[0])); memcpy (last, black, sizeof last); for (row=1; row < height-1; row++) { -- cgit 1.4.1