From 221cfb71391349fc37a53c884dfcc9a7ddaa27a3 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Mon, 26 Nov 2007 01:46:57 +0000 Subject: Fix crash due to sizeof() used where PAM_STRUCT_SIZE should be git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@470 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- editor/pamditherbw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'editor/pamditherbw.c') diff --git a/editor/pamditherbw.c b/editor/pamditherbw.c index 49e78a4e..f26468bb 100644 --- a/editor/pamditherbw.c +++ b/editor/pamditherbw.c @@ -153,6 +153,7 @@ parseCommandLine(int argc, char ** argv, } + static struct pam makeOutputPam(unsigned int const width, unsigned int const height) { @@ -339,7 +340,7 @@ doHilbert(FILE * const ifP, int *x,*y; int sum; - grays = pnm_readpam(ifP, &graypam, sizeof(graypam)); + grays = pnm_readpam(ifP, &graypam, PAM_STRUCT_SIZE(tuple_type)); bitpam = makeOutputPam(graypam.width, graypam.height); @@ -852,7 +853,7 @@ main(int argc, char *argv[]) { tuple * bitrow; int row; - pnm_readpaminit(ifP, &graypam, sizeof(graypam)); + pnm_readpaminit(ifP, &graypam, PAM_STRUCT_SIZE(tuple_type)); bitpam = makeOutputPam(graypam.width, graypam.height); -- cgit 1.4.1