Skip to content

Commit 8bb6b81

Browse files
committed
Update uriparser to commit 8c06d
1 parent 50ddf6a commit 8bb6b81

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

ext/uri/uriparser/include/uriparser/Uri.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ URI_PUBLIC int URI_FUNC(ParseSingleUriExMm)(URI_TYPE(Uri) * uri,
334334
* itself is not freed, only its members.
335335
* Uses default libc-based memory manager.
336336
*
337+
* @remarks
338+
* Calling on an all-zeros structure (e.g. through <c>memset</c> or <c>calloc</c>) is safe.<br/>
339+
* Calling on an uninitialized structure is <em>not</em> safe.
340+
*
337341
* @param uri <b>INOUT</b>: %URI structure whose members should be freed
338342
*
339343
* @see uriFreeUriMembersMmA
@@ -348,6 +352,10 @@ URI_PUBLIC void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri);
348352
* of the %URI structure. Note that the structure
349353
* itself is not freed, only its members.
350354
*
355+
* @remarks
356+
* Calling on an all-zeros structure (e.g. through <c>memset</c> or <c>calloc</c>) is safe.<br/>
357+
* Calling on an uninitialized structure is <em>not</em> safe.
358+
*
351359
* @param uri <b>INOUT</b>: %URI structure whose members should be freed
352360
* @param memory <b>IN</b>: Memory manager to use, NULL for default libc
353361
* @return 0 on success, error code otherwise

ext/uri/uriparser/src/UriCopy.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,
111111

112112
URI_CHECK_MEMORY_MANAGER(memory); /* may return */
113113

114+
URI_FUNC(ResetUri)(destUri);
115+
114116
if (URI_FUNC(CopyRangeAsNeeded)(&destUri->scheme, &sourceUri->scheme, URI_FALSE, memory) == URI_FALSE) {
115117
return URI_ERROR_MALLOC;
116118
}
@@ -153,7 +155,10 @@ int URI_FUNC(CopyUriMm)(URI_TYPE(Uri) * destUri,
153155
*(destUri->hostData.ip6) = *(sourceUri->hostData.ip6);
154156
}
155157

156-
if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostData.ipFuture, &sourceUri->hostData.ipFuture, URI_FALSE, memory) == URI_FALSE) {
158+
if (sourceUri->hostData.ipFuture.first != NULL && sourceUri->hostText.first == sourceUri->hostData.ipFuture.first) {
159+
destUri->hostData.ipFuture.first = destUri->hostText.first;
160+
destUri->hostData.ipFuture.afterLast = destUri->hostText.afterLast;
161+
} else if (URI_FUNC(CopyRangeAsNeeded)(&destUri->hostData.ipFuture, &sourceUri->hostData.ipFuture, URI_FALSE, memory) == URI_FALSE) {
157162
URI_FUNC(PreventLeakageAfterCopy)(destUri, doneMask, memory);
158163
return URI_ERROR_MALLOC;
159164
}

0 commit comments

Comments
 (0)