Excellent. I've checked this in with slight modifications ( moved the goto error up with the getenv(DXDATA)). While we're on patches, patch Greg's surname to Abram.
A opendx-dev broadcast of the cvs commit message is lacking, I suspect as an unwanted side-effect of our anti-spam measures. At least one person in this project should be running a heap debugger (e.g. purify) routinely. What do people use for linux? Thanks again, Pete Alan Ferrenberg wrote: > Below is a simple patch for the netcdf problem. The trick is that > when space for fname was being allocated, datadir hadn't been assigned > a value yet. A few lines later, when datadir was filled using > getenv("DXDATA"), fname was overrunning it's allocated memory. I > can't believe I've been fighting for a month to find a 1-line > bug! amf *** import_ncdf-old.c Thu Mar 02 09:29:18 EST 2000 > --- import_ncdf.c Thu Mar 02 14:36:23 EST 2000 > *************** > *** 470,475 **** > --- 470,476 ---- > * space for trailing /, .nc, trailing 0 and some slop > */ + datadir = (char *)getenv("DXDATA"); > fname = (char *)DXAllocateLocalZero((datadir ? strlen(datadir) : > 0) + > strlen(filename) + XTRA); > if (!fname) > *************** > *** 483,489 **** > return IMPORT_STAT_NOT_FOUND; > } - datadir = (char *)getenv("DXDATA"); > if (!datadir) > goto error; --- 484,489 ----