Changeset 14132

Show
Ignore:
Timestamp:
03/30/08 12:13:06 (3 months ago)
Author:
rouault
Message:

Fix write outside of allocated buffer in OGR PG driver (#2303)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.5/gdal/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp

    r12569 r14132  
    516516    { 
    517517      int length = pszTableName - pszLayerName; 
    518       pszSchemaName = (char*)CPLMalloc(length); 
     518      pszSchemaName = (char*)CPLMalloc(length+1); 
    519519      strncpy(pszSchemaName, pszLayerName, length); 
    520520      pszSchemaName[length] = '\0'; 
     
    532532    if( CSLFetchNameValue( papszOptions, "SCHEMA" ) != NULL ) 
    533533    { 
     534        CPLFree(pszSchemaName); 
    534535        pszSchemaName = CPLStrdup(CSLFetchNameValue( papszOptions, "SCHEMA" )); 
    535536    } 
  • branches/1.5/gdal/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp

    r13330 r14132  
    190190        } 
    191191 
     192        OGRPGClearResult( hResult ); 
    192193        /* Zero tuples means no PK is defined, perfectly valid case. */ 
    193194    }