Fix for yajl#188 potential UB
Apparently it is UB to use an enum in va_start()
This commit is contained in:
@@ -82,11 +82,12 @@ yajl_alloc(const yajl_callbacks * callbacks,
|
||||
}
|
||||
|
||||
int
|
||||
yajl_config(yajl_handle h, yajl_option opt, ...)
|
||||
yajl_config(yajl_handle h, int option, ...)
|
||||
{
|
||||
yajl_option opt = option; /* UB to use an enum in va_start */
|
||||
int rv = 1;
|
||||
va_list ap;
|
||||
va_start(ap, opt);
|
||||
va_start(ap, option);
|
||||
|
||||
switch(opt) {
|
||||
case yajl_allow_comments:
|
||||
|
||||
@@ -48,11 +48,12 @@ struct yajl_gen_t
|
||||
};
|
||||
|
||||
int
|
||||
yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...)
|
||||
yajl_gen_config(yajl_gen g, int option, ...)
|
||||
{
|
||||
yajl_gen_option opt = option; /* UB to use an enum in va_start */
|
||||
int rv = 1;
|
||||
va_list ap;
|
||||
va_start(ap, opt);
|
||||
va_start(ap, option);
|
||||
|
||||
switch(opt) {
|
||||
case yajl_gen_beautify:
|
||||
|
||||
@@ -105,7 +105,7 @@ extern "C" {
|
||||
* allocation (via yajl_alloc())
|
||||
* \returns zero in case of errors, non-zero otherwise
|
||||
*/
|
||||
YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...);
|
||||
YAJL_API int yajl_gen_config(yajl_gen hand, int option, ...);
|
||||
|
||||
/** Allocate a generator handle
|
||||
* \param allocFuncs An optional pointer to a structure which allows
|
||||
|
||||
@@ -162,7 +162,7 @@ extern "C" {
|
||||
* allocation (via yajl_alloc())
|
||||
* \returns zero in case of errors, non-zero otherwise
|
||||
*/
|
||||
YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...);
|
||||
YAJL_API int yajl_config(yajl_handle h, int option, ...);
|
||||
|
||||
/** Free a parser handle */
|
||||
YAJL_API void yajl_free(yajl_handle handle);
|
||||
|
||||
Reference in New Issue
Block a user