diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/UriCommon.c | 5 | ||||
-rw-r--r-- | src/UriNormalize.c | 6 | ||||
-rw-r--r-- | src/UriResolve.c | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/UriCommon.c b/src/UriCommon.c index 8b043f4..37d6b39 100644 --- a/src/UriCommon.c +++ b/src/UriCommon.c @@ -91,6 +91,11 @@ int URI_FUNC(CompareRange)( return ((a == NULL) ? 0 : 1) - ((b == NULL) ? 0 : 1); } + /* NOTE: Both NULL means equal! */ + if ((a->first == NULL) || (b->first == NULL)) { + return ((a->first == NULL) ? 0 : 1) - ((b->first == NULL) ? 0 : 1); + } + diff = ((int)(a->afterLast - a->first) - (int)(b->afterLast - b->first)); if (diff > 0) { return 1; diff --git a/src/UriNormalize.c b/src/UriNormalize.c index dbbc23e..49db9ff 100644 --- a/src/UriNormalize.c +++ b/src/UriNormalize.c @@ -424,9 +424,11 @@ static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri, if ((*doneMask & URI_NORMALIZE_PATH) == 0) { while (walker != NULL) { if (!URI_FUNC(MakeRangeOwner)(doneMask, 0, &(walker->text))) { - /* Kill path to one before walker */ + /* Free allocations done so far and kill path */ + + /* Kill path to one before walker (if any) */ URI_TYPE(PathSegment) * ranger = uri->pathHead; - while (ranger->next != walker) { + while (ranger != walker) { URI_TYPE(PathSegment) * const next = ranger->next; if ((ranger->text.first != NULL) && (ranger->text.afterLast != NULL) diff --git a/src/UriResolve.c b/src/UriResolve.c index 4af5b19..3660b6b 100644 --- a/src/UriResolve.c +++ b/src/UriResolve.c @@ -172,6 +172,7 @@ static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest, UriBool relSourceHasScheme = (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE; if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT) && (absBase->scheme.first != NULL) + && (relSource->scheme.first != NULL) && (0 == URI_FUNC(CompareRange)(&(absBase->scheme), &(relSource->scheme)))) { /* [00/32] undefine(R.scheme); */ relSourceHasScheme = URI_FALSE; |