Opened 21 years ago

Last modified 21 years ago

#310 closed defect (fixed)

Shape file name incorrectly generated

Reported by: jng@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc:

Description

In file ogrshapedatasource.cpp, method CreateLayer(), in conditional statement:

if( bSingleNewFile && nLayers == 0 )
{
        char *pszPath = CPLStrdup(CPLGetPath(pszName));
	pszBasename = CPLStrdup(CPLFormFilename(pszPath,
                                                CPLGetBasename(pszName), 
                                                NULL));
        CPLFree( pszPath );
}

CPLGetBasename() returns an address to a static variable in file cpl_port.cpp. 
This address is then passed as a string to CPLFormFilename(), which prints the 
string to the same static variable. Results in the file name being incorrectly 
generated. Need to make a deep copy of the string returned from CPLGetBasename 
and pass this deep copy as the argument to CPLFormFilename() instead.

Change History (1)

comment:1 by warmerdam, 21 years ago

I have patched this without any testing. The fix is now in CVS.

If you can easily test this from CVS I would appreciate verification the
fix works properly.

Thanks for your very specific bug report!

Note: See TracTickets for help on using tickets.