Closed Bug 221694 Opened 23 years ago Closed 22 years ago

ber_get_next_buffer_ext() fails when length or tag is split across buffers

Categories

(Directory Graveyard :: LDAP C SDK, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcs, Assigned: mcs)

Details

Attachments

(3 files, 3 obsolete files)

ber_get_next_buffer_ext() is not restartable in the sense that in some cases it will not pick up correctly where it left off when it is called more than once to read the same LDAP message. In particular, there are problems if the length is more than one byte long and the bytes that make up the length are split across two buffers that are passed to ber_get_next_buffer_ext() in two different calls. A similar problem exists for multi-byte tags (although those are rare) and ber_get_next() also may have similar bugs.
Priority: -- → P1
Target Milestone: --- → 5.13
Noriko is working on this bug.
Assignee: MarkCSmithWork → norikoyasuo
To cover the ber_get_next() issues I filed bug 222106 - "ber_get_next() fails when length or tag is split across buffers"
If the length is more than one byte long and the bytes that make up the length are split across the buffer boundary, the byte(s) read in the first read/receive is stored in ber_buf and combined with the rest read in the second read/receive, which could be repeated until the complete length info is received.
Comment on attachment 133294 [details] [diff] [review] proposal for fixing ber_get_next_buffer_ent The fix looks good. I will commit this soon.
Attachment #133294 - Flags: review+
It is worth noting that the fix does not address potential problems with multibyte tags. But I am pretty sure that all LDAP tags are one byte long.
Status: NEW → ASSIGNED
Attachment #133294 - Attachment is obsolete: true
Fix committed to the trunk: mozilla/directory/c-sdk/ldap/libraries/liblber/io.c new revision: 5.4; previous revision: 5.3 Fix bug # 221694 - ber_get_next_buffer_ext() fails when length or tag is split across buffers.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Reopened because we saw some problems that we can't explain.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Additional fixes committed to the trunk; reviewed by Noriko: mozilla/directory/c-sdk/ldap/libraries/liblber/io.c new revision: 5.6; previous revision: 5.5 Additional "bulletproofing" for bug # 221694 - ber_get_next_buffer_ext() fails when length or tag is split across buffers.
Assignee: norikoyasuo → MarkCSmithWork
Status: REOPENED → NEW
Marking fixed.
Status: NEW → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
Reopening bug. Need to more precisely indicate errors. Also, the recent changes broke some applications that checked *Bytes_Scanned == 0 to determine if a fatal error occurred; we need to be backward compatible.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #133886 - Attachment is obsolete: true
Attachment #133949 - Attachment is obsolete: true
Additional fix committed to the trunk; reviewed by Noriko and EY: mozilla/directory/c-sdk/ldap/libraries/liblber/io.c new revision: 5.7; previous revision: 5.6 Additional fix for 221694 - ber_get_next_buffer_ext() fails when length or tag is split across buffers. Improve backwards compatibility by setting *Bytes_Scanned to zero when errors occur; use errno to report specific errors.
Status: REOPENED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: