Document: N1673
Date: 2013-02-11

Defect Report #4nn

Previous Defect Report < - > Next Defect Report

Submitter: Douglas Walls
Submission Date: 2013-02-11
Reference Document: N1673
Version: 1.0
Subject: Should gets_s discard next input line when (s == NULL) ?


gets_s Annex K. 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

Previous Defect Report < - > Next Defect Report