From ba95bbc073e549e5e0164c8b9f7e7e3f76112cac Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Mon, 2 Apr 2018 18:23:22 -0600 Subject: [PATCH] dtudcfonted/gpftobdf.c: Coverity CID 175168; NULL deref --- cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c b/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c index 565f30a6..5bea3380 100644 --- a/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c +++ b/cde/programs/dtudcfonted/dtgpftobdf/gpftobdf.c @@ -1466,9 +1466,19 @@ int fix ; bitmap = pcf->bitmaps + getINT32( (unsigned char *)(pcf->offsets + encodingOffset), pcf->bmp_fmt); - invertBits( bitmap + bmp_adj, pcf->bmp_fmt, ptn_width, cpy_height, bmp_ptn + ptn_adj); - putPtn( (unsigned char *)bmp_ptn, ptn_width, ptn_height ); - fprintf(stdout,"ENDCHAR\n"); + /* Only do this if non-NULL... */ + if (bmp_ptn) + { + invertBits( bitmap + bmp_adj, pcf->bmp_fmt, + ptn_width, cpy_height, bmp_ptn + ptn_adj); + putPtn( (unsigned char *)bmp_ptn, ptn_width, ptn_height ); + } + else + { + fprintf(stderr, "%s: bmp_ptn is NULL", __FUNCTION__); + } + + fprintf(stdout,"ENDCHAR\n"); if( fix == FALSE ) free(bmp_ptn); } if( fix == TRUE ) free(bmp_ptn); -- 2.25.1