My Oracle Support Banner

Unexpected Behavior In ANSI C String Manipulation Functions, With Overlapping Strings (Doc ID 1336061.1)

Last updated on DECEMBER 23, 2022

Applies to:

Oracle Solaris Studio - Version Forte Developer 6 Update 2 to 12.6 [Release 6.0 to 12]
Information in this document applies to any platform.

Symptoms

Some standard library functions from libc which copy, append, or modify strings show unexpected behavior when source string and destination string overlap.

Example:

Changes

The issue is more likely to occur for 64-bit applications than for 32-bit applications.

The issue is more likely to occur on 64-bit applications on Solaris on x86-64


The issue is more likely to occur if the offset between the overlapping strings is small.

In many implementations, including the Solaris libc implementation, the issue is more likely to occur when the destination string starts at or after the beginning of the source string, rather than before the beginning of the source string.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
 Solution Summary
 Safe copying of overlapping strings
 Safe appending with overlapping strings
 Safe removal of the first N characters of a string
 Performance considerations
 References
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.