Bug 2766 - Implementation of the insque() function does not satisfy POSIX.
Summary: Implementation of the insque() function does not satisfy POSIX.
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.4
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-14 11:48 UTC by Alexander A. Sortov
Modified: 2014-07-04 16:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander A. Sortov 2006-06-14 11:48:30 UTC
The POSIX description of the insque() function says that "If the queue is to be 
used as a linear list, invoking insque(&element, NULL), where element is the 
initial element of the queue, shall initialize the forward and backward 
pointers of element to null pointers."
However this function in the current glibc causes the segmentation fault if the 
second parameter is NULL.

Example of the code:
#include <stdio.h>
#include <search.h>
	
typedef struct
{
    void* next;
    void* prev;
} Node;

int main()
{
    Node A;
    A.next = NULL;
    A.prev = NULL;
    insque(&A, NULL);
    return 0;
}
Comment 1 Ulrich Drepper 2006-06-17 17:01:41 UTC
Fixed in cvs.