summaryrefslogtreecommitdiff
path: root/printbuf.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix integer overflows.Tobias Stoeckmann2020-05-061-3/+16
| | | | | | | | | | | | The data structures linkhash and printbuf are limited to 2 GB in size due to a signed integer being used to track their current size. If too much data is added, then size variable can overflow, which is an undefined behaviour in C programming language. Assuming that a signed int overflow just leads to a negative value, like it happens on many sytems (Linux i686/amd64 with gcc), then printbuf is vulnerable to an out of boundary write on 64 bit systems.
* clang-format the filesdota172020-04-031-55/+65
|
* add the disabling formatting coments and adjust the partial code manulydota172020-04-031-3/+4
|
* PR#331: for Visual Studio, use a snprintf/vsnprintf wrapper that ensures the ↵Eric Haszlakiewicz2017-08-251-0/+1
| | | | string is terminated.
* vasprintf_compat.h: spin-off this compat header ; use math_compat.h as templateAlexandru Ardelean2016-11-221-41/+1
| | | | Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* initialize null terminator of new printbufPierce Lopez2016-07-161-0/+1
| | | | | | | | It's possible (e.g. by using json_object_from_file() on an empty file) to get json-c to try to use a printbuf that has never had anything written to it. Before this change, it could access a string that should be length zero, but was never initialized, and could theoretically have an unexpected string.
* Move the json_min() and json_max() macros to json_util.h and mark everything ↵Eric Haszlakiewicz2014-05-041-2/+3
| | | | | | else in bits.h deprecated. Eliminate all uses of bits.h within the json-c code.
* Replaced #if HAVE_X with #ifdef HAVE_X as the former test is troublemaker ↵Mateusz Loskot2012-05-211-4/+4
| | | | with #define HAVE_X where #define HAVE_X 1|0 is meant.
* Fix some bugs with how buffer sizes were being calcuated in printbuf_memset ↵Eric Haszlakiewicz2012-04-031-6/+14
| | | | and an off-by-one error in printbuf_memappend.
* Add a printbuf_memset() function to provide an effecient way to set and ↵Eric Haszlakiewicz2012-04-021-10/+45
| | | | append things like whitespace indentation.
* Some updates to make the code compatible with VC 9 (2008)John Arbash Meinel2012-02-011-1/+1
| | | | | VC 9 doesn't support late variable declarations, and doesn't have inttypes so we need some direct definitions of a couple of more types.
* Simplify things by storing integer values only as int64_t's internally, andehaszla2010-12-071-1/+1
| | | | | | | | | | omit the range check during parsing since we already have the checks when accessing the value. There is no longer a json_type_int64, only json_type_int. Fix some problems with parsing 0 and -0 values, and add a couple of tests. Fix some minor compile issues on HPUX environments. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@60 327403b1-1117-474d-bef2-5cb71233fd97
* * Rename min and max so we can never clash with C or C++ std libraryMichael Clark2009-07-251-1/+1
| | | | | | | | Ian Atha, thatha at yahoo-inc dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@43 327403b1-1117-474d-bef2-5cb71233fd97
* Erik Hovland (3):Christopher Watford2009-07-081-2/+2
| | | | | | | | | | Fix any noticeable spelling or grammar errors. Make sure every va_start has a va_end. Check all pointers for validity. git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@41 327403b1-1117-474d-bef2-5cb71233fd97
* optimizations to json_tokener_parse_ex(), printbuf_memappend()Michael Clark2009-04-271-6/+9
| | | | | | | -- Brent Miller, bdmiller at yahoo dash inc dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@34 327403b1-1117-474d-bef2-5cb71233fd97
* * Don't use this as a variable, so we can compile with a C++ compilerMichael Clark2009-02-251-3/+4
| | | | | | | | | | * Add casts from void* to type of assignment when using malloc * Add #ifdef __cplusplus guards to all of the headers * Add typedefs for json_object, json_tokener, array_list, printbuf, lh_table Michael Clark, <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@33 327403b1-1117-474d-bef2-5cb71233fd97
* * Fixed warning reported by adding -Wstrict-prototypesMichael Clark2009-02-251-1/+1
| | | | | | | | -Wold-style-definition to the compilatin flags. Dotan Barak, dotanba at gmail dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@30 327403b1-1117-474d-bef2-5cb71233fd97
* Add const correctness to public interfacesMichael Clark2009-01-061-1/+1
| | | | | | | | | | Gerard Krol, g dot c dot krol at student dot tudelft dot nl Update version number to 0.9 git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@27 327403b1-1117-474d-bef2-5cb71233fd97
* Add va_end for every va_start.Michael Clark2009-01-051-1/+2
| | | | | | | | Dotan Barak, dotanba at gmail dot com git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@23 327403b1-1117-474d-bef2-5cb71233fd97
* * Add macros to enable compiling out debug codeMichael Clark2007-10-251-1/+1
| | | | | | | Geoffrey Young, geoff at modperlcookbook dot org git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@18 327403b1-1117-474d-bef2-5cb71233fd97
* * Make headers C++ compatible by change *this to *objMichael Clark2007-03-131-11/+4
| | | | | | | | | | | | | | | * Add ifdef C++ extern "C" to headers * Use simpler definition of min and max in bits.h Larry Lansing, llansing at fuzzynerd dot com * Remove automake 1.6 requirement * Move autogen commands into autogen.sh. Update README * Remove error pointer special case for Windows * Change license from LGPL to MIT Michael Clark <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@10 327403b1-1117-474d-bef2-5cb71233fd97
* * printbuf.c - C. Watford (christopher dot watford at gmail dot com)Michael Clark2007-03-131-7/+52
| | | | | | | | | | | | | | | | | | | | | | | | | Added a Win32/Win64 compliant implementation of vasprintf * debug.c - C. Watford (christopher dot watford at gmail dot com) Removed usage of vsyslog on Win32/Win64 systems, needs to be handled by a configure script * json_object.c - C. Watford (christopher dot watford at gmail dot com) Added scope operator to wrap usage of json_object_object_foreach, this needs to be rethought to be more ANSI C friendly * json_object.h - C. Watford (christopher dot watford at gmail dot com) Added Microsoft C friendly version of json_object_object_foreach * json_tokener.c - C. Watford (christopher dot watford at gmail dot com) Added a Win32/Win64 compliant implementation of strndup * json_util.c - C. Watford (christopher dot watford at gmail dot com) Added cast and mask to suffice size_t v. unsigned int conversion correctness * json_tokener.c - sign reversal issue on error info for nested object parse spotted by Johan Bj�rklund (johbjo09 at kth.se) * json_object.c - escape " in json_escape_str * Change to automake and libtool to build shared and static library Michael Clark <michael@metaparadigm.com> git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@4 327403b1-1117-474d-bef2-5cb71233fd97
* import of version 0.1Michael Clark2007-03-131-0/+106
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@2 327403b1-1117-474d-bef2-5cb71233fd97