[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
This commit is contained in:
Roland Winklmeier
2016-01-11 16:08:33 +01:00
parent dda82f75d6
commit cf0e93afdc

View File

@@ -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);