| 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:31:51 +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:31 UTC ====================================================================== Summary: Unsafe use of LINE_MAX in fgets() example ====================================================================== ---------------------------------------------------------------------- (0000303) nsitbon (reporter) - 2009-11-12 20:31 http://austingroupbugs.net/view.php?id=182#c303 ---------------------------------------------------------------------- sizeof(char) == 1, can't change, or would break all existing application. The WG14 will never change this statement of the Standard. best practice is char * line = malloc((line_max + 1) * sizeof(*line)); so one could easily change type of line: wchar_t * line = malloc((line_max + 1) * sizeof(*line)); 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 2009-11-12 20:31 nsitbon Note Added: 0000303 ====================================================================== |
| 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] |