bugAVR C Runtime Library - Bugs: bug #6141, printf(), printf_P() dont check if...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #6141: printf(), printf_P() dont check if STDOUT == NULL

Submitter:  Andreas Becker <andreas_becker>
Submitted:  Fri 24 Oct 2003 10:52:45 AM UTC
   
 
Category:  Library Severity:  2 - Minor
Priority:  5 - Normal Item Group:  None
Status:  Invalid Assigned to:  joerg_wunsch
Percent Complete:  0% Open/Closed:  Closed
Release:  None Fixed Release:  None

Sun 19 Sep 2004 09:43:16 PM UTC, comment #2: 

Andreas never responded to my earlier discussion.

I still think it's a pilot error, and penalizing users who
properly ensure they don't pass NULL isn't the right way to
go.

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 12 Mar 2004 09:44:25 PM UTC, comment #1: 

I still think it's an operator fault rather than a bug.
After all, why penalize all users who do it right, by
introducing additional checks at each invocation?  (The
check needs to be done in putc() in order to be useful,
which will imply a high cost.)

Joerg Wunsch <joerg_wunsch>
Group administrator
Fri 24 Oct 2003 10:52:45 AM UTC, original submission:  

The Functions printf() and printf_P assume, that the caller allways did a fdevopen() before.
If not, they writing to the registers (printf_P, line 44)

My Solution looks like this:
insert the following code at printf.c:41 and printf_p.c:43.

if (stdout == NULL) {
  return EOF;
}
The check in printf.c protects the called vfprintf function.

Andreas Becker <andreas_becker>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-09-19 joerg_wunsch StatusNone Invalid
    Open/ClosedOpen Closed
2004-03-12 joerg_wunsch Severity3 - Normal 2 - Minor
2004-03-12 joerg_wunsch Assigned toNone joerg_wunsch

Back to the top

Powered by Savane 3.13-bb6a.
Corresponding source code