Opened 7 years ago

Closed 7 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 7 years ago.
avoid ora-00972 for column names

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by martinl

Attachment: oci-ora-00972.diff added

avoid ora-00972 for column names

comment:1 Changed 7 years ago by Even Rouault

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.

comment:2 in reply to:  1 ; Changed 7 years ago by martinl

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

comment:3 in reply to:  2 Changed 7 years ago by martinl

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 Changed 7 years ago by Even Rouault

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.

comment:5 in reply to:  4 ; Changed 7 years ago by 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.

comment:6 in reply to:  5 Changed 7 years ago by martinl

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 Changed 7 years ago by Even Rouault

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