Opened 4 years ago

Closed 4 years ago

#100 closed defect (fixed)

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 4 years ago.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by Lukáš Zaoral

Attachment: getline.patch added

comment:1 Changed 4 years ago by Vladimír Štill

Seem reasonable, I will look at the patch and integrate it.

comment:2 Changed 4 years ago by Vladimír Štill

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.