From cf0e93afdcb00f5325f9ababce35e8845e7ab03a Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Mon, 11 Jan 2016 16:08:33 +0100 Subject: [PATCH] [g2clib] Fix sigfault if simunpack() is called with 0 values to unpack Patch from Fedora 23 http://pkgs.fedoraproject.org/cgit/rpms/g2clib.git/tree/g2clib-simunpack.patch --- src/plugins/weatherdata/gfs/g2clib/simunpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/weatherdata/gfs/g2clib/simunpack.c b/src/plugins/weatherdata/gfs/g2clib/simunpack.c index dfa431bd1..8bc0ddb29 100644 --- a/src/plugins/weatherdata/gfs/g2clib/simunpack.c +++ b/src/plugins/weatherdata/gfs/g2clib/simunpack.c @@ -49,7 +49,7 @@ g2int simunpack(unsigned char *cpack,g2int *idrstmpl,g2int ndpts,g2float *fld) nbits = idrstmpl[3]; itype = idrstmpl[4]; - ifld=(g2int *)calloc(ndpts,sizeof(g2int)); + ifld=(g2int *)calloc((ndpts ? ndpts : 1),sizeof(g2int)); if ( ifld == 0 ) { fprintf(stderr,"Could not allocate space in simunpack.\n Data field NOT upacked.\n"); return(1);