Details

[Home]

Issue of the Standard # S0010

Brief

Lack of details in the requirements for memmem() function.

Detailed Description

Specification does not describe the behavior of the function
void * memmem(const void * haystack, size_t haystacklen, const void * needle, size_t needlelen);
when:

  • needlelen==0;
  • haystacklen==0 and needlelen==0.

Problem location(s) in the standard

Linux Standard Base Core Specification 3.1, Chapter 13. Base Libraries, 13.5. Interface Definitions for libc, description of function memmem.

Possible consequences

Possibly different behavior of applications on LSB-compliant implementations.

Possible solutions

Define function’s behavior in the above cases. We propose that memmem function should return 'haystack' in both cases.

Accepted

LSB Bugzilla, 1327

Status

Fixed in LSB 4.0

[Home]