summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2022-10-30 19:35:00 +0100
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2022-10-30 19:35:00 +0100
commit3033986433a2a79a1578d6d424f89e439e0444ef (patch)
tree1f9a12bfb94f12479d303df186c02fd7236d9b18 /src
parentfda4a6a8635254361196b0497803b7d01514203e (diff)
parent0feeaa712b06f955dc7b721c81d4133732917cad (diff)
Merge branch 'release/debian/0.9.7+dfsg-1'debian/0.9.7+dfsg-1
Diffstat (limited to 'src')
-rw-r--r--src/UriMemory.c5
-rw-r--r--src/UriParse.c29
2 files changed, 17 insertions, 17 deletions
diff --git a/src/UriMemory.c b/src/UriMemory.c
index baed204..916d7ce 100644
--- a/src/UriMemory.c
+++ b/src/UriMemory.c
@@ -42,12 +42,15 @@
* Holds memory manager implementation.
*/
-#include <config.h>
+#include "UriConfig.h" /* for HAVE_REALLOCARRAY */
#ifdef HAVE_REALLOCARRAY
# ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
# endif
+# ifdef __NetBSD__
+# define _OPENBSD_SOURCE 1
+# endif
#endif
#include <errno.h>
diff --git a/src/UriParse.c b/src/UriParse.c
index eefa8d1..a672c8e 100644
--- a/src/UriParse.c
+++ b/src/UriParse.c
@@ -478,6 +478,7 @@ static const URI_CHAR * URI_FUNC(ParseIpFuture)(URI_TYPE(ParserState) * state,
switch (*first) {
case _UT('v'):
+ case _UT('V'):
*/
if (first + 1 >= afterLast) {
URI_FUNC(StopSyntax)(state, afterLast, memory);
@@ -540,7 +541,9 @@ static URI_INLINE const URI_CHAR * URI_FUNC(ParseIpLit2)(
}
switch (*first) {
+ /* The leading "v" of IPvFuture is case-insensitive. */
case _UT('v'):
+ case _UT('V'):
{
const URI_CHAR * const afterIpFuture
= URI_FUNC(ParseIpFuture)(state, first, afterLast, memory);
@@ -624,11 +627,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -662,11 +660,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -788,6 +781,10 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
URI_FUNC(StopSyntax)(state, first + 1, memory);
return NULL; /* ":::+ "*/
}
+ } else if (quadsDone == 0 || first[1] == _UT(']')) {
+ /* Single leading or trailing ":" */
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
}
if (setZipper) {
@@ -797,7 +794,7 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
break;
case _UT('.'):
- if ((quadsDone > 6) /* NOTE */
+ if ((quadsDone + zipperEver > 6) /* NOTE */
|| (!zipperEver && (quadsDone < 6))
|| letterAmong
|| (digitCount == 0)
@@ -810,11 +807,6 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
/* Leading zero */
URI_FUNC(StopSyntax)(state, first - digitCount, memory);
return NULL;
- } else if ((digitCount > 2)
- && (digitHistory[1] == 0)) {
- /* Leading zero */
- URI_FUNC(StopSyntax)(state, first - digitCount + 1, memory);
- return NULL;
} else if ((digitCount == 3)
&& (100 * digitHistory[0]
+ 10 * digitHistory[1]
@@ -848,6 +840,11 @@ static const URI_CHAR * URI_FUNC(ParseIPv6address2)(
if (digitCount > 0) {
if (zipperEver) {
+ /* Too many quads? */
+ if (quadsDone >= 7) {
+ URI_FUNC(StopSyntax)(state, first, memory);
+ return NULL;
+ }
uriWriteQuadToDoubleByte(digitHistory, digitCount, quadsAfterZipper + 2 * quadsAfterZipperCount);
quadsAfterZipperCount++;
} else {