Opened 10 years ago

Closed 10 years ago

#5466 closed enhancement (fixed)

ogr-oci: ORA-00972: identifier is too long

Reported by: martinl Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: ogr, oci, ORA-00972
Cc: ilucena

Description

OGR OCI driver doesn't check length of column names ORA-00972 when writing data. If the length is more than 30 characters than adding such column fails. The attached patch avoids such failure, see warning below:

Warning 1: Column BonitovanyDilBonitovanaJednotkaKod is too long (at most 30 characters). Using BonitovanyDilBonitovanaJednot_.

Attachments (1)

oci-ora-00972.diff (1.4 KB ) - added by martinl 10 years ago.
avoid ora-00972 for column names

Download all attachments as: .zip

Change History (8)

by martinl, 10 years ago

Attachment: oci-ora-00972.diff added

avoid ora-00972 for column names

comment:1 by Even Rouault, 10 years ago

Cc: ilucena added

Martin,

apart szFieldName[sizeof( szFieldName )] = '\0'; which looks like a 1-byte-after-end-of-buffer and potential indentation issue (tabulation), I think you can go ahead with the patch.

in reply to:  1 ; comment:2 by martinl, 10 years ago

Replying to rouault:

apart szFieldName[sizeof( szFieldName )] = '\0'; which looks like a 1-byte-after-end-of-buffer and potential indentation issue (tabulation), I think you can go ahead with the patch.

done in r27449. Both notes reflected. After some testing I will do backport (if no objections) to 1.11 branch.

Martin

in reply to:  2 comment:3 by martinl, 10 years ago

Resolution: fixed
Status: newclosed

Replying to martinl:

done in r27449. Both notes reflected. After some testing I will do backport (if no objections) to 1.11 branch.

backported in r27582. Closing this ticket.

comment:4 by Even Rouault, 10 years ago

Resolution: fixed
Status: closedreopened

Martin, r27582 looks wrong at szFieldName[sizeof( szFieldName )] = '\0'; . It has the 1-byte-after-end-of-buffer write that r27449 as not. By the way, I think (should be verified, the snprintf man page isn't completely clear) that snprintf() always null terminate (contrary to strncpy !) so the line might be not needed at all.

in reply to:  4 ; comment:5 by martinl, 10 years ago

Replying to rouault:

Martin, r27582 looks wrong at szFieldName[sizeof( szFieldName )] = '\0'; . It has the 1-byte-after-end-of-buffer write that r27449 as not. By the way, I think (should be verified, the snprintf man page isn't completely clear) that snprintf() always null terminate (contrary to strncpy !) so the line might be not needed at all.

ops, sorry, should be hopefully fixed in r27583.

in reply to:  5 comment:6 by martinl, 10 years ago

Replying to martinl:

Replying to rouault:

Martin, r27582 looks wrong at szFieldName[sizeof( szFieldName )] = '\0'; . It has the 1-byte-after-end-of-buffer write that r27449 as not. By the way, I think (should be verified, the snprintf man page isn't completely clear) that snprintf() always null terminate (contrary to strncpy !) so the line might be not needed at all.

ops, sorry, should be hopefully fixed in r27583.

possible to close this ticket?

comment:7 by Even Rouault, 10 years ago

Milestone: 2.01.11.1
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.