vfscanf: Use struct scratch_buffer instead of extend_alloca
authorFlorian Weimer <fweimer@redhat.com>
Thu, 15 Oct 2015 14:37:48 +0000 (16:37 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 15 Oct 2015 15:18:51 +0000 (17:18 +0200)
commit95e83974812f5c6de0483690ef47787965bb817a
treec86080b681b554ae4466370a385b4fe23237e8fd
parentb994fd793799590f70ceb9a96f135bc2390bb4f3
vfscanf: Use struct scratch_buffer instead of extend_alloca

A custom character buffer is added in this commit, in the form of
struct char_buffer.  The char_buffer_add function replaces the
ADDW macro (which has grown with each successive security fix).
The char_buffer_add slow path is moved out-of-line, reducing
code size.

* stdio-common/vfscanf.c (MEMCPY): Remove macro.
(struct char_buffer): New type.
(char_buffer_start, char_buffer_size, char_buffer_error)
(char_buffer_rewind, char_buffer_add): New functions.
(ADDW): Remove macro, replaced by the char_buffer_add function.
(_IO_vfscanf_internal): Rewrite using struct char_buffer instead
of extend_alloca.  Make control flow more explicit.
ChangeLog
stdio-common/vfscanf.c