Skip to content

Commit e5c12ff

Browse files
author
czjaso
committed
Allow \u0000 escape sequences in JSON strings
1 parent eebe8bc commit e5c12ff

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

source/core_json.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ static uint8_t hexToInt( char c )
321321
*
322322
* @return true if a valid escape sequence was present;
323323
* false otherwise.
324-
*
325-
* @note For the sake of security, \u0000 is disallowed.
326324
*/
327325
static bool skipOneHexEscape( const char * buf,
328326
size_t * start,
@@ -358,7 +356,7 @@ static bool skipOneHexEscape( const char * buf,
358356
}
359357
}
360358

361-
if( ( i == end ) && ( value > 0U ) )
359+
if( i == end )
362360
{
363361
ret = true;
364362
*outValue = value;
@@ -382,8 +380,6 @@ static bool skipOneHexEscape( const char * buf,
382380
*
383381
* @return true if a valid escape sequence was present;
384382
* false otherwise.
385-
*
386-
* @note For the sake of security, \u0000 is disallowed.
387383
*/
388384
#define isHighSurrogate( x ) ( ( ( x ) >= 0xD800U ) && ( ( x ) <= 0xDBFFU ) )
389385
#define isLowSurrogate( x ) ( ( ( x ) >= 0xDC00U ) && ( ( x ) <= 0xDFFFU ) )
@@ -437,8 +433,6 @@ static bool skipHexEscape( const char * buf,
437433
*
438434
* @return true if a valid escape sequence was present;
439435
* false otherwise.
440-
*
441-
* @note For the sake of security, \NUL is disallowed.
442436
*/
443437
static bool skipEscape( const char * buf,
444438
size_t * start,
@@ -457,9 +451,6 @@ static bool skipEscape( const char * buf,
457451

458452
switch( c )
459453
{
460-
case '\0':
461-
break;
462-
463454
case 'u':
464455
ret = skipHexEscape( buf, &i, max );
465456
break;

0 commit comments

Comments
 (0)