Giter Club home page Giter Club logo

json-maker's People

Contributors

alcantor avatar antgeorge avatar caleb-daniels-sfc avatar hpfaz avatar jaymin1328 avatar rafagafe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

json-maker's Issues

Protection against buffer overrun

Hi,

Thanks for publishing this library! I have just been looking at using it in an embedded project, but it seems that when constructing json objects, it is possible to overrun the string buffer without knowing. Perhaps it is worth adding an argument (or a series of โ€œ_sโ€ suffixed methods) which take an additional length parameter and checks that the length of the string does not increase beyond the allocated buffer length ?

Double len

Hi! How do I set the output format for double? Example of how this is set for sprintf "%3.6f"

remLen is not correctly updated in the jfson_num function

Thanks for the great software!
During integration I found some inconsistencies when adding numbers to the json string.
The remLen variable did not update on the length of the number.

Changing json_num in the following manner seems to fix this:

#define json_num( funcname, type, fmt )
char* funcname( char* dest, char const* name, type value, size_t* remLen ) {
dest = primitivename( dest, name, remLen );
int len = snprintf( dest, *remLen, fmt, value );
dest += len;
*remLen -= len;
dest = chtoa( dest, ',', remLen );
return dest;
}

all the best,
Mike

Solidus character is escaped

Does the solidus character needs to be escaped?
Per the rfc https://www.ietf.org/rfc/rfc4627.txt

All Unicode characters may be placed within the
quotation marks except for the characters that must be escaped:
quotation mark, reverse solidus, and the control characters (U+0000
through U+001F).

the solidus doesn't require mandatorily to be escaped. So is it really required ?

error: too few arguments to function 'json_objOpen'

prototype in json-maker.h is
char* json_objOpen( char* dest, char const* name, size_t* remLen );

but the sample code is...
dest = json_objOpen( dest, name );

also noticed the code looked suspiciously reactionary to buffer overflow at...

   char buff[512];
    int len = data_to_json( buff, &data );
    if( len >= sizeof buff ) {
        fprintf( stderr, "%s%d%s%d\n", "Error. Len: ", len, " Max: ", (int)sizeof buff - 1 );
        return EXIT_FAILURE;
    }

betting that issue was fixed, but the sample code wasn't updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.