[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"Unidata User Support": Re: Error in netcdf 2.3.2
- Subject: "Unidata User Support": Re: Error in netcdf 2.3.2
- Date: Tue, 05 Jul 1994 14:35:21 -0600
- >keywords: 199406241439.AA19966 netCDF header file
- >organization: Research Systems
Hi Beth,
>I don't know if you have run across this error or not, but
>in local_nc.h the memory for the path field is not being allocated
>correctly. The path field is currently set to be FILENAME_MAX
>which varies on different systems (sometimes less than 255) and MAXPATHLEN
>is 255.
>
>The strncpy routine in file.c pads to MAXPATHLEN on non-null terminated
>strings. Because the path field wasn't allocated correctly, memory was
>getting clobbered and causing the software to seg fault.
>
>Our fix was to change the path field to be MAXPATHLEN and set MAXPATHLEN
>to more realistic values for the systems we were using. I included
>the fix below.
Thanks for reporting this. We apparently had discovered this bug previously
and fixed it by eliminating the use of MAXPATHLEN in favor of FILENAME_MAX
everywhere in the netCDF source code.
I'm surprised you saw this bug, since the use of MAXPATHLEN was apparently
eliminated from the netCDF 2.3 distribution over a year ago. Perhaps you
are looking at an older version of the source? The version of local_nc.h
that is in the current netCDF 2.3.2 version is from April 27 1993:
/* $Id: local_nc.h,v 1.39 1993/04/27 20:05:21 davis Exp $ */
--
Russ Rew UCAR Unidata Program
address@hidden P.O. Box 3000
http://www.unidata.ucar.edu/ Boulder, CO 80307-3000