Opened 20 years ago

Closed 19 years ago

#791 closed defect (fixed)

Mapxbase.c : uninit variable in msDBF Create crashes msDBFClose

Reported by: richard.roger@… Owned by: warmerdam
Priority: high Milestone:
Component: MapServer C Library Version: 4.2
Severity: normal Keywords:
Cc:

Description

In mapserver-4.2.1 distribution, Mapxbase.c
Symptom:
A DBF file is created using msDBFCreate().  When it is closed by msDBFClose(),
msDBFClose crashes with a segmentation violation at the statement:
    if(psDBF->pszStringField)free(psDBF->StringField);
indicating that psDBF->pszStringField is (a) not null, and (b) does not have 
a "proper" value.
Cause:
psDBF->pszStringField is not initialized by msDBFCreate(), and gets a rubbish 
value on my Sun Solaris 8 system when compiling, etc., with gcc 2.95.3.
Solution:
Add
  psDBF->pszStringField = NULL;
within msDBFCreate().
psDBF->nStringFieldLen and psDBF->bUpdated are not initialized either; perhaps 
they should be?

Change History (2)

comment:1 by fwarmerdam, 19 years ago

Owner: changed from sdlime to fwarmerdam
Steve,

I'll look into this one. 

comment:2 by fwarmerdam, 19 years ago

Resolution: fixed
Status: newclosed
I concur.  the pszStringField, nStringFieldLen and bUpdated are now initialized
in 4.5.  
Note: See TracTickets for help on using tickets.