Author: Douglas Walls
Technical Corregendum for DR 429
The original question asked in DR 429 was
The runtime-constraint violation here can be caused by a
pointer. Should we discard the next input line even if
(s == NULL) ?
When I wrote DR 429, I had not taken footnote 404) into
404) The gets_s function, unlike the historical gets function,
makes it a runtime-constraint violation for
a line of input to overflow the buffer to store it. Unlike the
fgets function, gets_s maintains a
one-to-one relationship between input lines and successful calls to
gets_s. Programs that use gets
expect such a relationship.
I now believe the answer to the question I posed in DR 429 is
The other minor issue pointed out in the DR is that that s
set to the null character when s==NULL. The following
correction is offered.
Suggested Technical Corrigendum for
Annex K.220.127.116.11, replace paragraph 3 with the following:
If there is a runtime-constraint violation, characters are read and
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 is set to the null character.