Skip to content

Commit

Permalink
MSSQL: Fix for the crash if uniqueidentifier is specified as fid colu…
Browse files Browse the repository at this point in the history
  • Loading branch information
szekerest committed Aug 18, 2012
1 parent 4de3245 commit 18c21b4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mapmssql2008.c
Expand Up @@ -1656,10 +1656,18 @@ int msMSSQL2008LayerGetShapeRandom(layerObj *layer, shapeObj *shape, long *recor
if (rc == SQL_ERROR || rc == SQL_SUCCESS_WITH_INFO)
handleSQLError(layer);

oidBuffer[retLen] = 0;
record_oid = strtol(oidBuffer, NULL, 10);
if (retLen < sizeof(oidBuffer))
{
oidBuffer[retLen] = 0;
record_oid = strtol(oidBuffer, NULL, 10);
shape->index = record_oid;
}
else
{
/* non integer fid column, use single pass */
shape->index = -1;
}

shape->index = record_oid;
shape->resultindex = (*record);

(*record)++; /* move to next shape */
Expand Down

0 comments on commit 18c21b4

Please sign in to comment.