You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2018/07/08 17:28:43 UTC
svn commit: r1835367 - /apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Author: minfrin
Date: Sun Jul 8 17:28:43 2018
New Revision: 1835367
URL: http://svn.apache.org/viewvc?rev=1835367&view=rev
Log:
Backport r1835366.
Remove redundant checks, trailing garbage is caught elsewhere.
Modified:
apr/apr-util/branches/1.7.x/json/apr_json_decode.c
Modified: apr/apr-util/branches/1.7.x/json/apr_json_decode.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.7.x/json/apr_json_decode.c?rev=1835367&r1=1835366&r2=1835367&view=diff
==============================================================================
--- apr/apr-util/branches/1.7.x/json/apr_json_decode.c (original)
+++ apr/apr-util/branches/1.7.x/json/apr_json_decode.c Sun Jul 8 17:28:43 2018
@@ -519,18 +519,12 @@ static apr_status_t apr_json_decode_bool
if (self->p >= self->e)
return APR_EOF;
- if (self->e - self->p >= 4 && strncmp("true", self->p, 4) == 0 &&
- (self->p == self->e ||
- (!isalnum(((unsigned char *)self->p)[4]) &&
- ((unsigned char *)self->p)[4] != '_'))) {
+ if (self->e - self->p >= 4 && strncmp("true", self->p, 4) == 0) {
self->p += 4;
*retval = 1;
return APR_SUCCESS;
}
- else if (self->e - self->p >= 5 && strncmp("false", self->p, 5) == 0 &&
- (self->p == self->e ||
- (!isalnum(((unsigned char *)self->p)[5]) &&
- ((unsigned char *)self->p)[5] != '_'))) {
+ else if (self->e - self->p >= 5 && strncmp("false", self->p, 5) == 0) {
self->p += 5;
*retval = 0;
return APR_SUCCESS;
@@ -678,10 +672,7 @@ out:
static apr_status_t apr_json_decode_null(apr_json_scanner_t * self)
{
- if (self->e - self->p >= 4 && strncmp("null", self->p, 4) == 0 &&
- (self->p == self->e ||
- (!isalnum(((unsigned char *)self->p)[4]) &&
- ((unsigned char *)self->p)[4] != '_'))) {
+ if (self->e - self->p >= 4 && strncmp("null", self->p, 4) == 0) {
self->p += 4;
return APR_SUCCESS;
}