Opened 3 weeks ago

#100 new defect

libc: getline implementation incorrectly checks the failure of realloc

Reported by: Lukáš Zaoral Owned by:
Priority: major Milestone: 4.4
Component: DiOS Keywords:
Cc: kdudka@…, jamartis@…, lzaoral@…

Description

Hello,
the following code results into a null pointer dereference in the implementation of getline when checked with divine verify.

#define _GNU_SOURCE
#include <stdio.h>

int main(void)
{
    char* line = NULL;
    size_t len = 0;
    getline(&line, &len, stdin);
}

The enclosed patch fixes the issue. Thanks!

Attachments (1)

getline.patch (421 bytes) - added by Lukáš Zaoral 3 weeks ago.

Download all attachments as: .zip

Change History (1)

Changed 3 weeks ago by Lukáš Zaoral

Attachment: getline.patch added
Note: See TracTickets for help on using tickets.