Ticket #1442 (closed defect: fixed)

Opened 8 years ago

Last modified 8 years ago

Segmentation fault when freeing attribute name

Reported by: silke.reimer@… Owned by: fsimon@…
Priority: high Milestone:
Component: Input - Native Oracle Spatial Support Version: unspecified
Severity: normal Keywords:
Cc:

Description

Hallo!

I found a bug in msOracleSpatialLayerGetItems: Copying rzt (the attribute name
filled by oracle) into flk strcpy is used. However strcopy does not take care
that only the attribute name is copied. Thus flk is filled with lots of rubbish.
Even if '\0' is filled at the right position to ensure that printing the
attribute name works well.

In some cases (as it did for me) this can lead to segmentation faults. I fixed
this by using strncpy instead:

--- maporaclespatial.c.orig     Mon Aug 15 19:40:40 2005
+++ maporaclespatial.c  Mon Aug 15 19:41:28 2005
@@ -1951,7 +1951,7 @@
         }
         else
         {
-            strcpy(flk, rzt);
+            strncpy(flk, rzt, flk_len);
             /*memcpy(flk, rzt, flk_len); #FIXED*/
             flk[flk_len] = '\0';
         }

Many greetings,

       Silke

Change History

Changed 8 years ago by fsimon@…

  • status changed from new to closed
  • resolution set to fixed
The bug was fixed in CVSHEAD (4.6).
Note: See TracTickets for help on using tickets.