Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 668 - f=fopen(fname,a) causes core dump when fname contains '\n'
Summary: f=fopen(fname,a) causes core dump when fname contains '\n'
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 5.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-01-02 15:11 UTC by allsupjd
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-01-04 17:52:00 UTC

Attachments (Terms of Use)

Description allsupjd 1999-01-02 15:11:58 UTC
Example program

--------------------=[ fopenbug.c ]=---------------------

#include <stdio.h>

int main()
  FILE * f;
  f = fopen("/etc/hosts\n","r");


Upon executing, gives
Segmentation fault(core dumped)

GCC as per RH5.1, GLIBC as per RH5.1

Potentially, this could be used to crash applications
that take filenames without filtering them -- I haven't
investigated further, but attacks may be possible.

Comment 1 David Lawrence 1999-01-03 21:37:59 UTC
I was able to replicate the problem. It has been assigned to a
developer for further review.

Comment 2 Cristian Gafton 1999-01-04 17:52:59 UTC
Invalid chars in fname will yield an unspecified behavior (Single Unix
Specs ver 2). Segfault is a perfectly valid "unspecified behavior" in
this case.

Note You need to log in before you can comment on or make changes to this bug.