Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#3412 closed bug (fixed)

stdio library code dishonors BUFSIZ for setbuf()

Reported by: schily Owned by: axeld
Priority: normal Milestone: R1
Component: - General Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

If a program calls:

char buf[BUFSIZ];

setbuf(stdout, buf);

then call many:
putc(char, fp);

stdio still tries to write more than BUFSIZ (1024) bytes into the buffer and overwrites it. This causes other global varibables in the binary (located past buf) to be overwritten.

This bug seems to be related to bug #3411

Change History (3)

comment:1 by schily, 15 years ago

Even with haiku-pre-alpha-gcc4-hrev31728-raw.zip BUFSIZE is not honored and the stdio code in libc overwrites the buffer resulting in a core dump.

comment:2 by bonefish, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev31776.

comment:3 by schily, 15 years ago

OK, the bug seems to be fixed now. The program that did dump core no longer fails.

Note: See TracTickets for help on using tickets.