* Null pointer dereference fix. Fix json_object_get_boolean strlen test
to not return TRUE for zero length string. Remove redundant includes.
Erik Hovland, erik at hovland dot org
git-svn-id: http://svn.metaparadigm.com/svn/json-c/trunk@31 327403b1-1117-474d-bef2-5cb71233fd97
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include "arraylist.h"
|
||||
#include "json_object.h"
|
||||
#include "json_object_private.h"
|
||||
#include "json_tokener.h"
|
||||
|
||||
#if !HAVE_STRNDUP
|
||||
char* strndup(const char* str, size_t n);
|
||||
@@ -306,7 +305,7 @@ boolean json_object_get_boolean(struct json_object *this)
|
||||
case json_type_double:
|
||||
return (this->o.c_double != 0);
|
||||
case json_type_string:
|
||||
if(strlen(this->o.c_string)) return TRUE;
|
||||
return (strlen(this->o.c_string) != 0);
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user