Opened 15 years ago

Closed 15 years ago

#2937 closed defect (fixed)

NITF driver : non NULL terminated buffer in LoadDODDatum

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

The following snippet may cause the szExpanded buffer to be not NULL terminated if pszDatumName[3] != ' '

    char szExpanded[5];
    const char *pszGTDatum = CSVFilename( "gt_datum.csv" );

    strncpy( szExpanded, pszDatumName, 3 );
    szExpanded[3] = '\0';
    if( pszDatumName[3] != ' ' )
    {
        strcat( szExpanded, "-" );
        strncat( szExpanded, pszDatumName + 3, 1 );
    }

Fix to follow

Change History (1)

comment:1 by Even Rouault, 15 years ago

Milestone: 1.7.0
Resolution: fixed
Status: newclosed

Fixed in r16726.

I believe the commit actually fixes the issue, but couldn't test it and don't think this is actually tested by one of the test in nitf.py...

Note: See TracTickets for help on using tickets.