Defect Report #429

Previous Defect Report < - > Next Defect Report


Submitter: Douglas Walls
Submission Date: 2013-02-11
Source: WG 14
Reference Documents: N1673  N1748
Version:
1.1
Date: October 2013
Subject: Should gets_s discard next input line when (s == NULL) ?

Summary

gets_s Annex K.3.5.4.1p2 says:

"If there is a runtime-constraint violation, s[0] is set to the null
character, and characters are read and discarded from stdin until a
new-line character is read, or end-of-file or a read error occurs."

The runtime-constraint violation here can be caused by a null "s"
pointer.  Should we discard the next input line even if (s == NULL) ?

The way it is written, it looks like the answer is yes.  However it is
not clear to us that that was the intent.  Note also that s[0] cannot be
set to the null character when s==NULL.

Suggested Technical Corrigendum


Apr 2013 meeting

Committee Discussion

Oct 2013 meeting

Committee Discussion

Proposed Technical Corrigendum

In Annex K.3.5.4.1, replace paragraph 3 with the following:
If there is a runtime-constraint violation, characters are read and discarded from stdin until a new-line character is read, or end-of-file or a read error occurs, and if s is not a null pointer s[0] is set to the null character.


Previous Defect Report < - > Next Defect Report