[PATCH v2 00/22] Fixed-size buffer removal

John Keeping john at keeping.me.uk
Sun Apr 7 16:26:29 CEST 2013


This version addresses all of Jason's comments from v1, plus a couple of
other issues I found while doing a more thorough review myself.

Changes to individual patches are described against each of them but
there are three new patches, which should be self-explanatory:

  2/22: Mark char* fields in struct cgit_page as const
  4/22: html.c: add fmtalloc helper
  5/22: shared.c: add strbuf_ensure_end

I've also learned my lesson about my ability to get things right first
time and how I shouldn't rely on the test suite, so I have spent some
time clicking around the UI and everything looks good to me.

John Keeping (22):
  Fix out-of-bounds memory accesses with virtual_root=""
  Mark char* fields in struct cgit_page as const
  Remove redundant calls to fmt("%s", ...)
  html.c: add fmtalloc helper
  shared.c: add strbuf_ensure_end
  cache.c: don't use statically sized buffers for filenames
  html: introduce html_txtf and html_vtxtf functions
  Convert cgit_print_error to a variadic function
  scan-tree: use struct strbuf instead of static buffers
  ui-log.c: use a strbuf for refs
  ui-log.c: use a strbuf for grep arguments
  ui-plain.c: use struct strbuf instead of fmt()
  ui-refs.c: use struct strbuf instead of fixed-size buffers
  ui-repolist.c: use struct strbuf for repository paths
  ui-snapshot.c: tidy up memory management in write_archive_type
  ui-snapshot: use a struct strbuf instead of fixed-size buffers
  ui-summary.c: use struct strbuf instead of fixed-size buffers
  ui-tag.c: use struct strbuf for user-supplied data
  ui-tree.c: use struct strbuf instead of fmt()
  cgit.c: use struct strbuf instead of fmt()
  html: add html_attrf to output an attribute value from a format string
  ui-shared.c: use struct strbuf instead of fmt()

 cache.c       |  57 ++++++++-------------
 cgit.c        | 101 +++++++++++++++++-------------------
 cgit.h        |  20 +++++---
 html.c        |  53 +++++++++++++++++--
 html.h        |  11 +++-
 scan-tree.c   | 160 ++++++++++++++++++++++++++++++++--------------------------
 shared.c      |  21 ++++++++
 ui-blob.c     |   8 +--
 ui-commit.c   |   4 +-
 ui-diff.c     |   8 +--
 ui-log.c      |  33 ++++++++----
 ui-patch.c    |   4 +-
 ui-plain.c    |  11 ++--
 ui-refs.c     |  10 ++--
 ui-repolist.c |  28 +++++-----
 ui-shared.c   |  89 ++++++++++++++++++--------------
 ui-shared.h   |   5 +-
 ui-snapshot.c |  76 +++++++++++++++++++---------
 ui-stats.c    |   5 +-
 ui-summary.c  |  12 +++--
 ui-tag.c      |  20 +++++---
 ui-tree.c     |  46 ++++++++---------
 22 files changed, 466 insertions(+), 316 deletions(-)

-- 
1.8.2.692.g17a9715





More information about the CGit mailing list