| To: | austin-group-l@xxxxxxxxxxxxx |
|---|---|
| Subject: | [1003.1(2008)/Issue 7 0000182]: Unsafe use of LINE_MAX in fgets() example |
| From: | Austin Group Bug Tracker <noreply@xxxxxxxxxxxxx> |
| Date: | Thu, 12 Nov 2009 20:22:09 +0000 |
| Keywords: | [1003.1(2008)/Issue 7] System Interfaces |
A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=182 ====================================================================== Reported By: Don Cragun Assigned To: ajosey ====================================================================== Project: 1003.1(2008)/Issue 7 Issue ID: 182 Category: System Interfaces Type: Error Severity: Comment Priority: normal Status: Under Review Name: Don Cragun Organization: Self User Reference: fgets() LINE_MAX Section: fgets() EXAMPLES Page Number: 852 Line Number: 28298-28308 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2009-11-12 19:23 UTC Last Modified: 2009-11-12 20:22 UTC ====================================================================== Summary: Unsafe use of LINE_MAX in fgets() example ====================================================================== ---------------------------------------------------------------------- (0000302) wpollock (reporter) - 2009-11-12 20:22 http://austingroupbugs.net/view.php?id=182#c302 ---------------------------------------------------------------------- It may be safe to assume fgets expects a stream of text as if it were reading a text file, but it is not safe to assume fgets won't be reading from stdin, i.e., a pipe or the keyboard. The wording should reflect that. Although fgets is defined strictly as working with bytes, someday that may change. As a result I think the example better not assume that one char equals one byte. I would thus change: line = malloc(line_max + 1); to: line = malloc(sizeof(char)*(line_max + 1)); Issue History Date Modified Username Field Change ====================================================================== 2009-11-12 19:23 Don Cragun New Issue 2009-11-12 19:23 Don Cragun Status New => Under Review 2009-11-12 19:23 Don Cragun Assigned To => ajosey 2009-11-12 19:23 Don Cragun Name => Don Cragun 2009-11-12 19:23 Don Cragun Organization => Self 2009-11-12 19:23 Don Cragun User Reference => fgets() LINE_MAX 2009-11-12 19:23 Don Cragun Section => fgets() EXAMPLES 2009-11-12 19:23 Don Cragun Page Number => 852 2009-11-12 19:23 Don Cragun Line Number => 28298-28308 2009-11-12 19:23 Don Cragun Interp Status => --- 2009-11-12 20:22 wpollock Note Added: 0000302 ====================================================================== |
| Previous by Date: | [1003.1(2008)/Issue 7 0000182]: Unsafe use of LINE_MAX in fgets() example, Austin Group Bug Tracker |
|---|---|
| Next by Date: | [1003.1(2008)/Issue 7 0000182]: Unsafe use of LINE_MAX in fgets() example, Austin Group Bug Tracker |
| Previous by Thread: | [1003.1(2008)/Issue 7 0000182]: Unsafe use of LINE_MAX in fgets() example, Austin Group Bug Tracker |
| Next by Thread: | [1003.1(2008)/Issue 7 0000182]: Unsafe use of LINE_MAX in fgets() example, Austin Group Bug Tracker |
| Indexes: | [Date] [Thread] [All Lists] |